package cn.fl.project.service.impl;

import cmm.comm.facade.framework.api.ISysCdMapApiService;
import cmm.comm.facade.framework.api.ISysCtrlCfgApiService;
import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCdMapDQueryCondition;
import cmm.comm.facade.framework.condition.SysCtrlCfgQueryCondition;
import cmm.comm.facade.framework.constant.SysCtrlCfgConstant;
import cmm.comm.facade.framework.dto.SysCdMapDDTO;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.api.IUploadApiService;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.comm.facade.upload.constant.UploadConstant;
import cmm.comm.facade.upload.dto.SysUlFilesRecDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.Pager;
import cmm.user.facade.system.api.IPriorityApiService;
import cmm.user.facade.system.api.ISysOrgApiService;
import cmm.user.facade.system.condition.SysOrgQueryCondition;
import cmm.user.facade.system.condition.SysUsrQueryCondition;
import cmm.user.facade.system.dto.SysOrgDTO;
import cmm.user.facade.system.dto.SysResourceDTO;
import cmm.user.facade.system.dto.SysUsrDTO;
import cmm.user.facade.system.dto.SysUsrDatAuthRDTO;
import cmm.web.core.framework.constant.SysOrgConstant;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.*;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.audit.condition.AudCreditInfoQueryCondition;
import cn.fl.audit.condition.AudReturnVisitQueryCondition;
import cn.fl.audit.constant.AudStandingBookConstant;
import cn.fl.audit.dto.AudCreditInfoDTO;
import cn.fl.audit.dto.AudReturnVisitDTO;
import cn.fl.audit.service.IAuditApiService;
import cn.fl.audit.transform.AudCreditInfoVOTransform;
import cn.fl.audit.transform.AudReturnVisitVOTransform;
import cn.fl.audit.vo.AudCreditInfoVO;
import cn.fl.audit.vo.AudReturnVisitVO;
import cn.fl.capital.condition.CapFundSummaryQueryCondition;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.capital.service.ICapFundSummaryService;
import cn.fl.capital.vo.CapFundSummaryVO;
import cn.fl.commons.result.ResponseData;
import cn.fl.customer.service.ICstNpSocialRlService;
import cn.fl.customer.transform.CstBscInfoVOTransform;
import cn.fl.customer.vo.CstBscInfoVO;
import cn.fl.customer.vo.CstNpSocialRlVO;
import cn.fl.expatriate.api.IExpBizManRecApiService;
import cn.fl.flowauth.api.IPrjFlowAuthCtrlApiService;
import cn.fl.flowauth.condition.PrjFlowAuthCtrlQC;
import cn.fl.flowauth.constant.PrjFlowAuthCtrlConstant;
import cn.fl.flowauth.dto.PrjFlowAuthCtrlDTO;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.base.utils.WebBaseUtils;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.mcr.api.VinUtilsApiService;
import cn.fl.ofe.api.IOfeMileageLogApiService;
import cn.fl.preloan.IAuditStandingBookService;
import cn.fl.preloan.IPrjBscInfoApiService;
import cn.fl.preloan.IProprdLicenseService;
import cn.fl.preloan.condition.AuditStandingBookQueryCondition;
import cn.fl.preloan.dto.GetPrjPrdLicInfoListRequest;
import cn.fl.preloan.dto.GetPrjPrdLicInfoListResponseDTO;
import cn.fl.preloan.dto.audit.AudStandingBookListRequest;
import cn.fl.preloan.dto.audit.AuditStandingBookDTO;
import cn.fl.product.service.IMfrInfoService;
import cn.fl.product.service.IPrdBscInfoService;
import cn.fl.product.service.IPrdCarInfoService;
import cn.fl.product.service.IPrdTkInfoService;
import cn.fl.product.transform.PrdCarInfoVOTransform;
import cn.fl.product.transform.PrdTkInfoVOTransform;
import cn.fl.product.vo.MfrInfoVO;
import cn.fl.product.vo.PrdBscInfoVO;
import cn.fl.product.vo.PrdCarInfoVO;
import cn.fl.product.vo.PrdTkInfoVO;
import cn.fl.project.ProjectUtils;
import cn.fl.project.api.IPrjCstAccInfoApiService;
import cn.fl.project.api.IPrjPaySchMYqApiService;
import cn.fl.project.api.IProjectModifyApiService;
import cn.fl.project.api.IProjectQueryApiService;
import cn.fl.project.condition.*;
import cn.fl.project.constant.*;
import cn.fl.project.dto.*;
import cn.fl.project.service.*;
import cn.fl.project.transform.PrjBscExtVOTransform;
import cn.fl.project.transform.PrjBscInfoVOTransform;
import cn.fl.project.vo.*;
import cn.fl.ref.fribaseinfo.transform.FriBaseInfoVOTransform;
import cn.fl.ref.fribaseinfo.vo.FriBaseInfoVO;
import cn.fl.system.service.ISysOrgService;
import cn.fl.system.service.ISysUlFilesRecService;
import cn.fl.system.transform.SysUlFilesRecVOTransform;
import cn.fl.system.transform.SysUsrVOTransform;
import cn.fl.system.vo.SysUlFilesRecVO;
import cn.fl.system.vo.SysUsrVO;
import cn.lb.framework.poi.pdf.export.PdfExportServer;
import cn.lb.framework.poi.util.ImageUtil;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import com.lionbridge.activiti.WorkflowClient;
import com.lionbridge.activiti.dto.MessageDTO;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.condition.*;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.customer.facade.customer.dto.*;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.FlowStartParamsDTO;
import fl.product.facade.product.condition.PrdBscInfoQueryCondition;
import fl.product.facade.product.constant.ProductConstant;
import fl.product.facade.product.dto.PrdCarInfoDTO;
import fl.product.facade.product.dto.PrdTkInfoDTO;
import fl.ref.fribaseinfo.condition.FriBaseInfoQueryCondition;
import fl.ref.fribaseinfo.service.IFriBaseInfoApiService;
import fl.riskctrl.facade.riskctrl.api.IRiskCtrlSearchApiService;
import fl.riskctrl.facade.riskctrl.dto.RcCstBscInfoDTO;
import fl.riskctrl.facade.riskctrl.rccstchannelinfo.dto.RcCstChannelInfoDTO;
import fl.spl.facade.framework.constant.SplSystemConstant;
import fl.spl.facade.mfr.condition.MfrInfoQueryCondition;
import fl.spl.facade.spl.api.ISplInfoApiService;
import fl.spl.facade.spl.dto.SplInfoDTO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.*;

/**
 * @Description: 项目基础信息表 客户端服务层接口实现 业务层方法名称前缀： 新增：add* 删除：remove* 修改：modify*
 *               批量：batch* 查询对象：select* get* 查询集合：search*
 */
@Service
public class PrjBscInfoServiceImpl implements IPrjBscInfoService {

	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private IProjectApiService projectApiService;

	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private IProjectModifyApiService projectModifyApiService;
	

	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private IProjectQueryApiService projectQueryApiService;
	/**
	 * 字典服务
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	/**
	 * 产品 服务层BEAN
	 */
	@Autowired
	private IPrdBscInfoService prdBscInfoService;

	@Autowired
	private IPrjFlowAuthCtrlApiService prjFlowAuthCtrlService;

	/**
	 * 产品 服务层BEAN
	 */
	@Autowired
	private IMfrInfoService mfrInfoService;

	/**
	 * 卡车 服务层BEAN
	 */
	@Autowired
	private IPrdTkInfoService prdTkInfoService;

	/**
	 * 映射表API服务
	 */
	@Autowired
	private ISysCdMapApiService sysCdMapApiService;

	/**
	 * 乘用车 服务层BEAN
	 */
	@Autowired
	private IPrdCarInfoService prdCarInfoService;

	/**
	 * 项目产品 服务层BEAN
	 */
	@Autowired
	private IPrjPrdBscInfoService prjPrdBscInfoService;

	/**
	 * 项目乘用车 服务层BEAN
	 */
	@Autowired
	private IPrjPrdCarInfoService prjPrdCarInfoService;

	/**
	 * 项目卡车 服务层BEAN
	 */
	@Autowired
	private IPrjPrdTkInfoService prjPrdTkInfoService;
	/**
	 * 上传文件主配置数据 服务层BEAN
	 */
	@Autowired
	private ISysOrgService sysOrgService;

	/**
	 * SysUlFilesRec 服务层BEAN
	 */
	@Autowired
	private ISysUlFilesRecService sysUlFilesRecService;

	/**
	 * 项目联系人 服务层BEAN
	 */
	@Autowired
	private IPrjLinkManService prjLinkManService;

	/**
	 * 抵押担保信息 服务层BEAN
	 */
	@Autowired
	private IPrjCstAssMbInfoService prjCstAssMbInfoService;
	/**
	 * 还款能力
	 */
	@Autowired
	private IPrjCstRepayAbiService prjCstRepayAbiService;
	/**
	 * 收益分析
	 */
	@Autowired
	private IPrjCstProfitAnaService prjCstProfitAnaService;
	/**
	 * 权限模块
	 */
	@Autowired
	private IPriorityApiService priorityApiService;
	/**
	 * 文件上传
	 */
	@Autowired
	private IUploadApiService uploadApiService;
	/**
	 * 访谈记录
	 */
	@Autowired
	private IPrjCstEmpIntvRecService prjCstEmpIntvRecService;

	/**
	 * 调查报告
	 */
	@Autowired
	private IPrjCstInvestRptService prjCstInvestRptService;
	@Autowired
	private IPrjCstOwnVehicleService prjCstOwnVehicleService;
	@Autowired
	private IPrjQuatPrpsService prjQuatPrpsService; // 方案
	@Autowired
	private IPrjQuatPrpsFeeService prjQuatPrpsFeeService; // 方案费用

	@Autowired
	private ISplInfoApiService splInfoApiService; // 供应商

	@Autowired
	private ICustomerApiService customerApiService;// 客户
	@Autowired
	private IPrjCstBscInfoService prjCstBscInfoService;
	@Autowired
	private ISysOrgApiService sysOrgApiService;// 组织机构

	@Autowired
	private IPrjPrdDtlService prjPrdDtlService;// 组织机构

	@Autowired
	private IPrjPrdPaySchMService prjPrdPaySchMService;// 组织机构
	@Autowired
	private ICstNpSocialRlService cstNpSocialRlService;// 组织机构
	@Autowired
	private IAuditApiService auditApiService;
	@Autowired
	private ISysCtrlCfgApiService SysCtrlCfgApiService;
	
	@Autowired
	private ICapFundSummaryService capFundSummaryService;
	
	@Autowired
	private IRiskCtrlSearchApiService riskCtrlSearchApiService;
	@Autowired
	private IPrjCstAccInfoService prjCstAccInfoService;
	@Autowired
	private IPrjPrdDtlService prjprdDtlService;
	@Autowired
	private IPrjPrdLicInfoService prjPrdLicInfoService;
	@Autowired
	private IOfeMileageLogApiService ofeMileageLogApiService;
	/**
	 * 项目客户账户信息表 暴露服务
	 */
	@Autowired
	private IPrjCstAccInfoApiService prjCstAccInfoApiService;
    @Autowired
    private IVehicleSrcService vehicleSrcService;
    @Autowired
    private VinUtilsApiService vinUtilsApiService;
    @Autowired
	private IProprdLicenseService iProprdLicenseService;
	@Autowired
	private IFriBaseInfoApiService friBaseInfoApiService;
	@Autowired
	private IExpBizManRecApiService expBizManRecApiService;
	@Autowired
	private IPrjPaySchMYqApiService prjPaySchMYqApiService;
	@Autowired
	private IAuditStandingBookService auditStandingBookService;
	@Override
	public PrjBscInfoVO selectById(Long id) throws BaseException {
		if (StringUtils.isEmpty(id))
			return null;
		// TODO 业务逻辑
		PrjBscInfoDTO dto = this.projectApiService.selectPrjBscInfoById(id,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		return PrjBscInfoVOTransform.toVO(dto);
	}

	@Override
	public PrjBscInfoVO selectPrjBscInfoById(Long id) throws BaseException {
		if (StringUtils.isEmpty(id)) {
			return null;
		}
		return PrjBscInfoVOTransform.toVO(this.projectApiService.selectById(id));
	}

	public List<PrjBscInfoVO> searchList(PrjBscInfoQueryCondition qc)
			throws BaseException {
		List<PrjBscInfoVO> list = PrjBscInfoVOTransform
				.toVOList(this.projectApiService.searchList(qc,
						CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd()));
		return list;
	}

	@Override
	public Integer updateFundPrjBscInfo(PrjBscInfoVO prjBscInfoVO) throws BaseException {
		return this.projectApiService.updateFundPrjBscInfo(PrjBscInfoVOTransform.toDTO(prjBscInfoVO));
	}

	@Override
	public List<KeyValueVO> getCompensatoryTypeList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_COMPENSATORY_TYPE;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getGuaranteePaymentTypeList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_GUARANTEE_PAYMENT_TYPE;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getBigCstWorkSourceList() throws BaseException {
		String code = DictionaryConstant.BIG_CST_WORK_SOURCE;
		return this.getKeyValueList(code);
	}

	@Override
	public Long add(PrjBscInfoVO entity) throws BaseException {
		if (null == entity)
			return null;
		String buOrgCd = WebBaseUtils.getBuOrgCd(entity.getOrgCd());
		entity.setBuOrgCd(buOrgCd);
		PrjBscInfoDTO dto = PrjBscInfoVOTransform.toDTO(entity);
		return this.projectApiService.addPrjBscInfo(dto);
	}

	@Override
	public boolean removeById(Long id) throws BaseException {
		if (StringUtils.isEmpty(id))
			return false;
		// return this.prjBscInfoApiService.removeById(id);
		// TODO 业务逻辑
		return false;
	}

	@Override
	public boolean modify(PrjBscInfoVO entity) throws BaseException {
		if (null == entity)
			return false;
		String buOrgCd = WebBaseUtils.getBuOrgCd(entity.getOrgCd());
		entity.setBuOrgCd(buOrgCd);
		return this.projectApiService.modifyPrjBscInfo(PrjBscInfoVOTransform
				.toDTO(entity));
	}
	
	@Override
	public boolean modifyPrjBscInfo(PrjBscInfoVO entity) throws BaseException {
		if (null == entity)
			return false;
		String buOrgCd = WebBaseUtils.getBuOrgCd(entity.getCstMgrOrgCd());
		entity.setBuOrgCd(buOrgCd);
		return this.projectApiService.modifyPrjBscInfo(PrjBscInfoVOTransform
				.toDTO(entity));
	}

	@SuppressWarnings("unchecked")
	@Override
	public Pager searchListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = this.projectApiService.searchPrjBacInfoListPage(page,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		page.setResultList(PrjBscInfoVOTransform
				.toVOList((List<PrjBscInfoDTO>) page.getResultList()));

		List<SysOrgDTO> list = this.sysOrgApiService.searchSysOrgListBy(CurrentThreadContext.getCurrentSysCd());
		Map<String, SysOrgDTO> buOrgCdMap = new HashMap<>();
		if (CollectionUtils.isNotEmpty(list)) {
			for (SysOrgDTO sysOrgDTO : list) {
				buOrgCdMap.put(sysOrgDTO.getOrgCd(), sysOrgDTO);
			}
		}
		SysOrgDTO sysOrgDTO = null;
		String orgCd = null;
		List<PrjBscInfoVO> vos = (List<PrjBscInfoVO>)page.getResultList();
		if(CollectionUtils.isNotEmpty(vos)){
			for(PrjBscInfoVO vo :vos){
				//0展示发送至录单员按钮  1不展示
				vo.setIsSendToRecoder("1");
				//只展示给重卡事业部 二手车金融事业部客户经理 客车事业部、新能源事业部、轻卡事业部，未提交且未发送录单请求
				if ((PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(vo.getBuOrgCd()) || PrjBscInfoConstant.CODE_ORG_CD_ESC.equals(vo.getBuOrgCd())
						|| PrjBscInfoConstant.CODE_BU_ORG_CD_ZC.equals(vo.getBuOrgCd()) || PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(vo.getBuOrgCd())
						|| PrjBscInfoConstant.CODE_BU_ORG_CD_QK.equals(vo.getBuOrgCd())) && vo.getPrjStsCd().equals(FlowConstant.FLOW_CHECK_STATE_NON)) {
					//功能角色权限
					List<SysResourceDTO> quitPrioList = this.priorityApiService.searchFuncWithAuth(CurrentThreadContext.getCurrentSysCd(),
							CurrentThreadContext.getCurrentRoleId(), "prjSendToRecorder");
					//存在说明有权限
					if (CollectionUtils.isNotEmpty(quitPrioList)) {
						//判断是否发送过
						AudStandingBookListRequest audRequest = new AudStandingBookListRequest();
						AuditStandingBookQueryCondition condition = new AuditStandingBookQueryCondition();
						condition.setProjectId(vo.getId());
						condition.setBookTypeCd(AudStandingBookConstant.AUD_TYP_CD_PL);
						audRequest.setCondition(condition);
						audRequest.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
						audRequest.setSysCd(CurrentThreadContext.getCurrentSysCd());
						ResponseData<List<AuditStandingBookDTO>> listResponseData = auditStandingBookService.searchList(audRequest);
						//为空说明未生产评审台账，即未发送过
						if (ResponseData.SUCCESS_CODE.equals(listResponseData.getCode())) {
							List<AuditStandingBookDTO> audResponseData = listResponseData.getData();
							if (CollectionUtils.isEmpty(audResponseData)) {
								vo.setIsSendToRecoder("0");
							}
						}
						//校验当前用户是否被限制
						PrjFlowAuthCtrlQC strlQc = new PrjFlowAuthCtrlQC();
						strlQc.setIsValid(1);
						strlQc.setPassiveCtrlId(CurrentThreadContext.getCurrentUserId());
						strlQc.setFlowStartTm(DateUtils.formatDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
						strlQc.setCtrlPrjTypCd(vo.getPrjTypCd());
						strlQc.setCtrlContent(PrjFlowAuthCtrlConstant.CTRL_CONTENT_1);
						//是否允许发送至录单员：0-禁止
						strlQc.setIsAllowSendToRecoder("0");
						BaseLogUtils.newLogger("立项.查询项目流程权限控制.prjId:{},qc:{}", vo.getId(), JSON.toJSONString(strlQc)).info();
						List<PrjFlowAuthCtrlDTO> prjFlowAuthCtrlDTOS = prjFlowAuthCtrlService.searchList(strlQc);
						BaseLogUtils.newLogger("立项.查询项目流程权限控制.prjId:{},result:{}", vo.getId(), prjFlowAuthCtrlDTOS.size()).info();
						if (CollectionUtils.isNotEmpty(prjFlowAuthCtrlDTOS) && prjFlowAuthCtrlDTOS.size() > 0) {
							for (PrjFlowAuthCtrlDTO prjFlowAuthCtrlDTO : prjFlowAuthCtrlDTOS) {
								if (StringUtils.isNotEmpty(CurrentThreadContext.getCurrentOrgCd()) && CurrentThreadContext.getCurrentOrgCd().startsWith(prjFlowAuthCtrlDTO.getPassiveCtrlOrgCd())) {
									vo.setIsSendToRecoder("1");
								}
							}
						}
						//二手车交易贷、车抵贷线下、内转交易贷隐藏按钮
						if (vo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || vo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD)
								|| vo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)){
							vo.setIsSendToRecoder("1");
						}
					}
				}
				if (buOrgCdMap.containsKey(vo.getCstMgrOrgCd())) {
					sysOrgDTO = buOrgCdMap.get(vo.getCstMgrOrgCd());
					vo.setCstMgrOrgCdNm(sysOrgDTO.getOrgNm());
					orgCd = sysOrgDTO.getOrgCd();
					while(orgCd.length()>8){
						if("4".equals(sysOrgDTO.getOrgTypCd())){//分公司
							vo.setCyOrgCdNm(sysOrgDTO.getOrgNm());
						}else if("3".equals(sysOrgDTO.getOrgTypCd())){
							vo.setPrOrgCdNm(sysOrgDTO.getOrgNm());
							break;
						}
						orgCd = orgCd.substring(0,orgCd.length()-4);
						if(buOrgCdMap.containsKey(orgCd)){
							sysOrgDTO = buOrgCdMap.get(orgCd);
						}else{
							break;
						}
					}
				}
			}
		}
		return page;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Pager LoansearchListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = this.projectApiService.LoansearchPrjBacInfoListPage(page,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd()); 
		page.setResultList(PrjBscInfoVOTransform
				.toVOList((List<PrjBscInfoDTO>) page.getResultList()));
		
		List<SysOrgDTO> list = this.sysOrgApiService.searchSysOrgListBy(CurrentThreadContext.getCurrentSysCd());
        //合同签署方式
        Map<String, String> cntTypCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_CNT_TYP_CD);
        //回访状态
        Map<String, String> visitStatusMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.VISIT_STATUS);
		//审批类型
        Map<String, String> SCHR6ListMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.RC_CP_MOD_EXT_INFO_SCHR6);
        //所属区域
		Map<String, String> cstMgrRgnCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE_REGION_CD);

        Map<String, SysOrgDTO> buOrgCdMap = new HashMap<>();
        if (CollectionUtils.isNotEmpty(list)) {
            for (SysOrgDTO sysOrgDTO : list) {
                buOrgCdMap.put(sysOrgDTO.getOrgCd(), sysOrgDTO);
            }
        }
        SysOrgDTO sysOrgDTO = null;
        String orgCd = null;
        List<Long> PrjIds = new ArrayList<>();
		List<PrjBscInfoVO> vos = (List<PrjBscInfoVO>)page.getResultList();
		for (PrjBscInfoVO prjBscInfoVO : vos) {
			Long id = prjBscInfoVO.getId();
			PrjIds.add(id);
		}
		List<PrjPrdBscInfoDTO> PrjPrdBscInfoList = new ArrayList<>();
		PrjPrdBscInfoQueryCondition PrjPrdBscInfoQc = new PrjPrdBscInfoQueryCondition();
		if(CollectionUtils.isNotEmpty(PrjIds)){
			//项目产品基础信息表
			PrjPrdBscInfoQc.setPrjIdList(PrjIds);
			PrjPrdBscInfoList =  this.projectApiService.searchPrjPrdBscInfoList(PrjPrdBscInfoQc);
		}
		Integer  SumprdQty = null;
		if(CollectionUtils.isNotEmpty(vos)){
			for(PrjBscInfoVO vo :vos){
				if(SCHR6ListMap.containsKey(vo.getSchr_6())){
					vo.setSchr_6(SCHR6ListMap.get(vo.getSchr_6()));//审批类型
				}
				if(visitStatusMap.containsKey(vo.getVisitStatus())){
					vo.setVisitStatus(visitStatusMap.get(vo.getVisitStatus()));//回访状态
				}
				for (PrjPrdBscInfoDTO prjPrdBscInfo : PrjPrdBscInfoList) {
				 if(prjPrdBscInfo.getPrjId().equals(PrjPrdBscInfoQc.getPrjId())){
						//资产数量
						SumprdQty = prjPrdBscInfo.getPrdQty();
						vo.setPrdQty(SumprdQty);
						//项目产品类型
						vo.setPrdTypCd(prjPrdBscInfo.getPrdTypCd());
					}
				}
				 if(cntTypCdMap.containsKey(vo.getCntTypCd())){//合同签署方式
					vo.setCntTypCdNm(cntTypCdMap.get(vo.getCntTypCd()));	
				}
				if(cstMgrRgnCdMap.containsKey(vo.getCstMgrRgnCd())){//所属区域
					vo.setCstMgrRgnCdNm(cstMgrRgnCdMap.get(vo.getCstMgrRgnCd()));
				}
				 
				if (buOrgCdMap.containsKey(vo.getCstMgrOrgCd())) {
		            sysOrgDTO = buOrgCdMap.get(vo.getCstMgrOrgCd());
		            vo.setCstMgrOrgCdNm(sysOrgDTO.getOrgNm());
		            orgCd = sysOrgDTO.getOrgCd();
		            while(orgCd.length()>8){
		                if("4".equals(sysOrgDTO.getOrgTypCd())){//分公司
		                    vo.setCyOrgCdNm(sysOrgDTO.getOrgNm());
		                }else if("3".equals(sysOrgDTO.getOrgTypCd())){
		                    vo.setPrOrgCdNm(sysOrgDTO.getOrgNm());
		                    break;
		                }
		                orgCd = orgCd.substring(0,orgCd.length()-4);
		                if(buOrgCdMap.containsKey(orgCd)){
		                    sysOrgDTO = buOrgCdMap.get(orgCd);
		                }else{
		                    break;
		                }
		            }
		        }
			}
		}
		return page;
	}
	@SuppressWarnings("unchecked")
	@Override
	public Pager searchReListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = this.projectApiService.searchRePrjBacInfoListPage(page,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		page.setResultList(PrjBscInfoVOTransform
				.toVOList((List<PrjBscInfoDTO>) page.getResultList()));
		
		List<SysOrgDTO> list = this.sysOrgApiService.searchSysOrgListBy(CurrentThreadContext.getCurrentSysCd());
        Map<String, SysOrgDTO> buOrgCdMap = new HashMap<>();
        if (CollectionUtils.isNotEmpty(list)) {
            for (SysOrgDTO sysOrgDTO : list) {
                buOrgCdMap.put(sysOrgDTO.getOrgCd(), sysOrgDTO);
            }
        }
        SysOrgDTO sysOrgDTO = null;
        String orgCd = null;
		List<PrjBscInfoVO> vos = (List<PrjBscInfoVO>)page.getResultList();
		if(CollectionUtils.isNotEmpty(vos)){
			for(PrjBscInfoVO vo :vos){
				if (buOrgCdMap.containsKey(vo.getCstMgrOrgCd())) {
		            sysOrgDTO = buOrgCdMap.get(vo.getCstMgrOrgCd());
		            vo.setCstMgrOrgCdNm(sysOrgDTO.getOrgNm());
		            orgCd = sysOrgDTO.getOrgCd();
		            while(orgCd.length()>8){
		                if("4".equals(sysOrgDTO.getOrgTypCd())){//分公司
		                    vo.setCyOrgCdNm(sysOrgDTO.getOrgNm());
		                }else if("3".equals(sysOrgDTO.getOrgTypCd())){
		                    vo.setPrOrgCdNm(sysOrgDTO.getOrgNm());
		                    break;
		                }
		                orgCd = orgCd.substring(0,orgCd.length()-4);
		                if(buOrgCdMap.containsKey(orgCd)){
		                    sysOrgDTO = buOrgCdMap.get(orgCd);
		                }else{
		                    break;
		                }
		            }
		        }
			}
		}
		return page;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Pager searchOldListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = this.projectApiService.searchOldPrjBacInfoListPage(page,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		page.setResultList(PrjBscInfoVOTransform
				.toVOList((List<PrjBscInfoDTO>) page.getResultList()));
		return page;
	}

	@Override
	public DataResultDTO addFlowStart(FlowStartParamsDTO flowStartParamsDTO)
			throws BaseException {
		if (StringUtils.isEmpty(flowStartParamsDTO.getCrtUsrId())
				|| StringUtils.isEmpty(flowStartParamsDTO.getBusinessKey())) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600,
					"用户ID和业务数据主键必须要存在!");
		}
		return this.projectApiService.addFlowStart(flowStartParamsDTO);
	}

	@Override
	public List<KeyValueVO> getProjectTypeList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_TYPE_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getBizResTypeList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_BIZ_RES_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getDsList() throws BaseException {
		String code = WebBaseConstant.CODE_SYS_CHL_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getPrjApyCrdtList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_APY_CRDT_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getPrjStsList() throws BaseException {
		String code = DictionaryConstant.CODE_AUD_STS_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getBizTypeList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_BIZ_TYP_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getGPSAudStsList() throws BaseException {
		String code = DictionaryConstant.CODE_GPS_AUD_STS_CD;
		return this.getKeyValueList(code);
	}

	@Override
    public List<KeyValueVO> getAudStsList() throws BaseException{
	    String code = PrjPrdVehInfoConstant.PRJ_VEH_AUD_STS_CD;
	    return this.getKeyValueList(code);
    }

	@Override
	public List<KeyValueVO> getGpsNmList() throws BaseException {
		String code = DictionaryConstant.CODE_GPS_MFR_CD;
		return this.getKeyValueList(code);
	}
	
	@Override
	public String getPrdTypVal(String prdTypCd) throws BaseException {
		String code = DictionaryConstant.CODE_PRD_TYE_CD;
		return this.getKeyValue(code,prdTypCd);
	}
	
	@Override
	public List<KeyValueVO> getGpsTypList() throws BaseException {
		String code = DictionaryConstant.CODE_GPS_TYPE_CD;
		return this.getKeyValueList(code);
	}
	
	
	

	public List<KeyValueVO> getPrdUntList() throws BaseException {
		String code = DictionaryConstant.CODE_PRD_UNT_CD;
		return this.getKeyValueList(code);
	}

	public List<KeyValueVO> getCstRptTypList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_CST_RPT_TYP_CD;
		return this.getKeyValueList(code);
	}

	public List<KeyValueVO> getRegionList() throws BaseException {
		String code = DictionaryConstant.CODE_REGION_CD;
		return this.getKeyValueList(code);
	}

    @Override
    public void removePassAndIngPrjBscInfoByIds(List<Long> idList, Long usrId) throws BaseException {
        this.projectModifyApiService.removePassAndIngPrjBscInfoByIds(idList,usrId);
    }

    @Override
    public DataResultDTO addNonInsFlowStart(Long prjId, String reason, Long usrId, String usrNm) throws BaseException {
        if(StringUtils.isEmpty(prjId)){
            return new DataResultDTO(BaseConstant.IS_YESNO_NO, "项目主键为空!");
        }
        if(StringUtils.isEmpty(usrId)){
            return new DataResultDTO(BaseConstant.IS_YESNO_NO, "用户ID为空!");
        }
        return projectApiService.addNonInsFlowStart(prjId, reason, usrId, usrNm);
    }

    public List<KeyValueVO> getKeyValueList(String code) throws BaseException {
		List<KeyValueVO> keyValueList = null;
		List<SysDictionaryDTO> dictionaryList = this.sysDictionaryApiService
				.searchGroup(CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd(), code);
		if (CollectionUtils.isNotEmpty(dictionaryList)) {
			keyValueList = new ArrayList<>();
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryList) {
				KeyValueVO keyValue = new KeyValueVO();
				keyValue.setKey(sysDictionaryDTO.getCode());
				keyValue.setValue(sysDictionaryDTO.getCodeNm());
				keyValueList.add(keyValue);
			}
		}
		return keyValueList;
	}

    public List<KeyValueVO> getPrjTypCdALLKV() throws BaseException {
        return this.sysDictionaryApiService.getKvListAll(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentBuOrgCd());
    }

    @Override
	public List<KeyValueVO> getKeyValueList(String code, String sysCd, String orgCd) throws BaseException {
		List<KeyValueVO> keyValueList = null;
		List<SysDictionaryDTO> dictionaryList = this.sysDictionaryApiService
				.searchGroup(sysCd, orgCd, code);
		if (CollectionUtils.isNotEmpty(dictionaryList)) {
			keyValueList = new ArrayList<>();
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryList) {
				KeyValueVO keyValue = new KeyValueVO();
				keyValue.setKey(sysDictionaryDTO.getCode());
				keyValue.setValue(sysDictionaryDTO.getCodeNm());
				keyValueList.add(keyValue);
			}
		}
		return keyValueList;
	}
	
	public List<KeyValueVO> getKeyValueDetailList(String code) throws BaseException {
		List<KeyValueVO> keyValueList = null;
		List<SysDictionaryDTO> dictionaryList = this.sysDictionaryApiService
				.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd(), code);
		if (CollectionUtils.isNotEmpty(dictionaryList)) {
			keyValueList = new ArrayList<>();
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryList) {
				KeyValueVO keyValue = new KeyValueVO();
				keyValue.setKey(sysDictionaryDTO.getCode());
				keyValue.setValue(sysDictionaryDTO.getCodeNm());
				keyValueList.add(keyValue);
			}
		}
		return keyValueList;
	}
	
	public String getKeyValue(String code,String param) throws BaseException {
		String result="error!";
		List<SysDictionaryDTO> dictionaryList = this.sysDictionaryApiService
				.searchGroup(CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd(), code);
		if (CollectionUtils.isNotEmpty(dictionaryList)) {
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryList) {
				if(sysDictionaryDTO.getCode().equals(param)){
					return sysDictionaryDTO.getCodeNm();
				}
			}
		}
		return result;
	}
	

	@Override
	public List<SysUsrVO> getCstMgrListByOrgId(String orgCd) {
		if (StringUtils.isEmpty(orgCd)) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请先选择组织机构!");
		}
		List<SysUsrDTO> usrList = this.projectApiService.getCstMgrListByOrgId(
				orgCd, CurrentThreadContext.getCurrentSysCd());
		return SysUsrVOTransform.toVOList(usrList);
	}
	
	@Override
	public Pager getCstMgrListByOrgIdPage(Pager page) {
		if (StringUtils.isEmpty(((SysUsrQueryCondition)(page.getCondition())).getOrgCd())) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请先选择组织机构!");
		}
		page = this.projectApiService.getCstMgrListByOrgIdPage(
				page, CurrentThreadContext.getCurrentSysCd());
		page.setResultList(SysUsrVOTransform
				.toVOList((List<SysUsrDTO>) page.getResultList()));
		return page;
	}

	@Override
	public JSONArray getMfrKvlist(String name) {
		JSONArray array = new JSONArray();
		MfrInfoQueryCondition qc = new MfrInfoQueryCondition();
		if (StringUtils.isNotBlank(name)) {
			qc.setMfrName(name);
		}
		qc.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
		qc.setIsValid(BaseConstant.IS_YESNO_YES);
		List<MfrInfoVO> mfrKlist = this.mfrInfoService.searchList(qc);
		if (CollectionUtils.isNotEmpty(mfrKlist)) {
			for (MfrInfoVO mfrInfoVO : mfrKlist) {
				JSONObject obj = new JSONObject();
				obj.put("id", mfrInfoVO.getId());
				obj.put("text", mfrInfoVO.getMfrName());
				array.add(obj);
			}
		}
		return array;
	}

	@Override
	public PrdBscInfoVO getPrdBscAndPrdDetailInfo(String prdType,
			String prdDetailId) {
		if (StringUtils.isBlank(prdDetailId)
				|| StringUtils.isBlank(prdDetailId)) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请先选择商品信息!");
		}
		Long prdId = null;
		PrdTkInfoVO tkInfo = null;
		PrdCarInfoVO carInfoVO = null;
		PrdBscInfoVO prdBscInfoVO = null;
		if (StringUtils.isNotBlank(prdType)) {
			prdType = prdType.substring(0, ProductConstant.PRD_TYE_LENGHT);
		}
		if (prdType.equals(ProductConstant.PRD_BUS_CD)
				|| prdType.equals(ProductConstant.PRD_CAR_CD)
				|| prdType.equals(ProductConstant.PRD_TK_CD_11)
				|| prdType.equals(ProductConstant.PRD_TYP_CD_019)
				|| prdType.equals(ProductConstant.PRD_TYP_CD_020)) {
			// 乘用车或者客车
			carInfoVO = this.prdCarInfoService.selectPrdCarById(Long
					.valueOf(prdDetailId));
			if (null != carInfoVO) {
				prdId = carInfoVO.getPrdId();
			}

		} else {
			// 卡车
			tkInfo = this.prdTkInfoService
					.selectById(Long.valueOf(prdDetailId));
			if (null != tkInfo) {
				prdId = tkInfo.getPrdId();
			}

		}
		if (StringUtils.isNotEmpty(prdId)) {
			// 查询是商品基础信息
			prdBscInfoVO = this.prdBscInfoService.selectById(Long
					.valueOf(prdId));
			String orgCd = CurrentThreadContext.getCurrentOrgCd();
			SysCtrlCfgQueryCondition qc = new SysCtrlCfgQueryCondition();
			qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			if(orgCd.length()>8){
				if(orgCd.substring(0, 8).equals("00000008")){
					qc.setCtrlCode(DictionaryConstant.CTRL_PRJ_PRD_COUNT_ZK);
				}else{
					qc.setCtrlCode(DictionaryConstant.CTRL_PRJ_PRD_COUNT);
				}
			}else{
				qc.setCtrlCode(DictionaryConstant.CTRL_PRJ_PRD_COUNT);
			}
			String ctrValue = SysCtrlCfgApiService
					.searchSysCtrlCfgByCtrlCode(qc);
			prdBscInfoVO.setCtrValue(ctrValue);
			if (null != carInfoVO) {
				prdBscInfoVO.setPrdCarInfoVO(carInfoVO);
			}
			if (null != tkInfo) {
				prdBscInfoVO.setPrdTkInfoVO(tkInfo);
			}
		}

		return prdBscInfoVO;
	}

	@Override
	public Pager searchPrdAndPrdDetailListPage(Pager page) {
		if (null == page)
			return new Pager();
		Pager pager = this.prdBscInfoService.searchListPage(page);
		List<PrdBscInfoVO> prdBscInfoList = (List<PrdBscInfoVO>) pager
				.getResultList();
		PrdBscInfoQueryCondition qc = (PrdBscInfoQueryCondition) page
				.getCondition();
		String prdType = qc.getPrdTypCd();
		for (PrdBscInfoVO prdBscInfoVO : prdBscInfoList) {
			if (prdType.equals(ProductConstant.PRD_BUS_CD)
					|| prdType.equals(ProductConstant.PRD_CAR_CD)) {
				// 乘用车或者客车
				List<PrdCarInfoVO> carInfoVOList = this.prdCarInfoService
						.getPrdCarInfoByPrdId(prdBscInfoVO.getId());
				prdBscInfoVO.setPrdCarInfoVOList(carInfoVOList);
			} else {
				// 卡车
				List<PrdTkInfoVO> tkInfoList = this.prdTkInfoService
						.getPrdTkInfoByPrdId(prdBscInfoVO.getId());
				prdBscInfoVO.setPrdTkInfoVOList(tkInfoList);
			}
		}
		pager.setResultList(prdBscInfoList);
		return pager;
	}

	@Override
	public Pager getPrdTKInfoPage(Pager page) throws BaseException {
		Pager pager = this.prdTkInfoService.getPrdTKInfoPage(page,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());

		List<PrdTkInfoVO> prdTkInfoList = PrdTkInfoVOTransform
				.toVOList((List<PrdTkInfoDTO>) pager.getResultList());
		List<Long> ids = new ArrayList<Long>();
		if (CollectionUtils.isNotEmpty(prdTkInfoList)) {
			for (PrdTkInfoVO prdTkInfoVO : prdTkInfoList) {
				if (null != prdTkInfoVO.getPrdId()) {
					ids.add(prdTkInfoVO.getPrdId());
					/*
					 * PrdBscInfoVO vo =
					 * this.prdBscInfoService.selectById(prdTkInfoVO
					 * .getPrdId()); prdTkInfoVO.setPrdBscInfoVO(vo);
					 */
				}
			}

			PrdBscInfoQueryCondition qc = new PrdBscInfoQueryCondition();
			qc.setIds(ids);
		/*	List<PrdBscInfoDTO> prdList = this.productApiService
					.searchPrdBscInfoList(qc,
							CurrentThreadContext.getCurrentSysCd(),
							CurrentThreadContext.getCurrentOrgCd());
			if (CollectionUtils.isNotEmpty(prdList)) {
				for (PrdTkInfoVO prdTkInfoVO : prdTkInfoList) {
					for (PrdBscInfoDTO prdBscInfoDTO : prdList) {
						if (prdTkInfoVO.getPrdId()
								.equals(prdBscInfoDTO.getId())) {
							prdTkInfoVO.setPrdBscInfoVO(PrdBscInfoVOTransform
									.toVO(prdBscInfoDTO));
							break;
						}
					}
				}
			}*/
			pager.setResultList(prdTkInfoList);
		}
		return pager;
	}

	@Override
	public Pager getPrdCarInfoPage(Pager page) throws BaseException {
		Pager pager = this.prdCarInfoService.getPrdCarInfoPage(page,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		List<PrdCarInfoVO> prdCarInfoList = PrdCarInfoVOTransform
				.toVOList((List<PrdCarInfoDTO>) pager.getResultList());
		List<Long> idList = new ArrayList<Long>();
		for (PrdCarInfoVO prdCarInfoVO : prdCarInfoList) {
			idList.add(prdCarInfoVO.getPrdId());
			/*
			 * PrdBscInfoVO vo =
			 * this.prdBscInfoService.selectById(prdCarInfoVO.getPrdId());
			 * prdCarInfoVO.setPrdBscInfoVO(vo);
			 */
		}
		/*PrdBscInfoQueryCondition qc = new PrdBscInfoQueryCondition();
		qc.setIds(idList);
		if (idList.size() > 0) {
			List<PrdBscInfoDTO> prdList = this.productApiService
					.searchPrdBscInfoList(qc,
							CurrentThreadContext.getCurrentSysCd(),
							CurrentThreadContext.getCurrentOrgCd());
			if (CollectionUtils.isNotEmpty(prdList)) {
				for (PrdCarInfoVO prdCarInfoVO : prdCarInfoList) {
					for (PrdBscInfoDTO prdBscInfoDTO : prdList) {
						if (prdCarInfoVO.getPrdId().equals(
								prdBscInfoDTO.getId())) {
							prdCarInfoVO.setPrdBscInfoVO(PrdBscInfoVOTransform
									.toVO(prdBscInfoDTO));
							break;
						}
					}
				}
			}
		}*/
		pager.setResultList(prdCarInfoList);
		return pager;
	}

	@Override
	public JSONArray searchPrdTyeList() throws BaseException {
		SysCdMapDQueryCondition qc = new SysCdMapDQueryCondition();
		qc.setmTypCd("M0005"); // 映射类型代码
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd()); // 系统代码
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd()); // 目标代码值(组织架构集合)
		// qc.setCodeGrpCd("PRD9999");
		List<SysCdMapDDTO> searchSysCdMapDWithTargetList = this.sysCdMapApiService
				.searchSysCdMapDWithTargetList(qc);
		JSONArray array = this.getMenuTree(searchSysCdMapDWithTargetList,
				ProductConstant.PRD_GEN_CD);
		return array;
	}

	private JSONArray getMenuTree(List<SysCdMapDDTO> list, String pidCode) {
		JSONArray tree = new JSONArray();
		for (SysCdMapDDTO sysCdMapDDTO : list) {
			JSONObject obj = new JSONObject();
			String code = sysCdMapDDTO.getTCode();
			obj.put("sGrpCd", sysCdMapDDTO.getSGrpCd()); // 源代码组值
			obj.put("sCode", sysCdMapDDTO.getSCode()); // 源代码值
			obj.put("tGrpCd", sysCdMapDDTO.getTGrpCd()); // 目标代码组值
			obj.put("id", sysCdMapDDTO.getTCode()); // 目标代码值
			obj.put("text", sysCdMapDDTO.getTCodeNm()); // 目标代码名
			String pid = sysCdMapDDTO.getTPCode();
			if (pidCode.equals(pid)) {
				JSONArray childTree = this.getMenuTree(list, code);
				obj.put("children", childTree);
				tree.add(obj);
			}
		}
		return tree;
	}

	@Deprecated
	@Override
	public Long addPrjPrdBscAndDetailInfo(PrjPrdBscInfoVO prdBscInfoVO,
			PrjPrdCarInfoVO prdCarInfoVO, PrjPrdTkInfoVO prdTkInfoVO) {
		if (null == prdBscInfoVO) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请填写商品基础信息!");
		}
		// 查询是否有支付表信息
		PrjPrdPaySchMQueryCondition qc = new PrjPrdPaySchMQueryCondition();
		qc.setPrjId(prdBscInfoVO.getPrjId());
        qc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
		List<PrjPrdPaySchMVO> prjQuatList = this.prjPrdPaySchMService
				.searchList(qc);
		if (CollectionUtils.isNotEmpty(prjQuatList)) {
			prdBscInfoVO.setRemoveFlag(String
					.valueOf(BaseConstant.IS_YESNO_YES));
		} else {
			prdBscInfoVO
					.setRemoveFlag(String.valueOf(BaseConstant.IS_YESNO_NO));
		}
		Long prdId = this.prjPrdBscInfoService.addPrjPrdBscAndDetailInfo(
				prdBscInfoVO, prdCarInfoVO, prdTkInfoVO);
		/*
		 * //保存产品基础信息 Long prdId= this.prjPrdBscInfoService.add(prdBscInfoVO);
		 * if(StringUtils.isNotEmpty(prdId)&&null!=prdCarInfoVO){
		 * prdCarInfoVO.setId(prdId); Long carId =
		 * this.prjPrdCarInfoService.add(prdCarInfoVO); }
		 * if(StringUtils.isNotEmpty(prdId)&&null!=prdTkInfoVO){
		 * prdTkInfoVO.setId(prdId); Long tkId =
		 * this.prjPrdTkInfoService.add(prdTkInfoVO); }
		 */
		return prdId;
	}

	@Deprecated
	@Override
	public void modifyPrjPrdBscAndDetailInfo(PrjPrdBscInfoVO prdBscInfoVO,
			PrjPrdCarInfoVO prdCarInfoVO, PrjPrdTkInfoVO prdTkInfoVO) {
		if (null == prdBscInfoVO) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请填写商品基础信息!");
		}
		// 查询是否有支付表信息
		PrjPrdPaySchMQueryCondition qc = new PrjPrdPaySchMQueryCondition();
		qc.setPrjId(prdBscInfoVO.getPrjId());
        qc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
		List<PrjPrdPaySchMVO> prjQuatList = this.prjPrdPaySchMService
				.searchList(qc);
		PrjPrdBscInfoVO prdbsc = this.prjPrdBscInfoService
				.selectById(prdBscInfoVO.getId());

		if (CollectionUtils.isNotEmpty(prjQuatList)
				&& (prdBscInfoVO.getGuidePc().doubleValue() != (prdbsc
						.getGuidePc().doubleValue()) || prdBscInfoVO
						.getPrdQty() != prdbsc.getPrdQty())) {
			prdBscInfoVO.setRemoveFlag(String
					.valueOf(BaseConstant.IS_YESNO_YES));
		} else {
			prdBscInfoVO
					.setRemoveFlag(String.valueOf(BaseConstant.IS_YESNO_NO));
		}
		// 修改产品基础信息
		/*
		 * this.prjPrdBscInfoService.modify(prdBscInfoVO);
		 * if(null!=prdCarInfoVO){
		 * this.prjPrdCarInfoService.modify(prdCarInfoVO); }
		 * if(null!=prdTkInfoVO){ this.prjPrdTkInfoService.modify(prdTkInfoVO);
		 * }
		 */
		this.prjPrdBscInfoService.modifyPrjPrdBscAndDetailInfo(prdBscInfoVO,
				prdCarInfoVO, prdTkInfoVO);
	}

	public List<KeyValueVO> getLoanTypCdList() throws BaseException {
		String dicCode = DictionaryConstant.CODE_PRJ_TYP_CD;
		return this.getKeyValueList(dicCode);
	}

	@Override
	public boolean getCurrentUserRoleStatus(Long currRoleId)
			throws BaseException {
		// 查询角色列表
		boolean flag = false;
		List<SysDictionaryDTO> dictionaryList = this.sysDictionaryApiService
				.searchGroup(CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd(),
						DictionaryConstant.CODE_CST_MGR_ROLE_CD);
		if (CollectionUtils.isNotEmpty(dictionaryList)) {
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryList) {
				if (currRoleId.toString().equals(sysDictionaryDTO.getCode())) {
					flag = true;
					break;
				}
			}
		}
		return flag;
	}

	@Override
	public String getOrgTextName(Long currentOrgId) {
		return projectApiService.getOrgTextName(currentOrgId,
				CurrentThreadContext.getCurrentSysCd());
	}

	@Override
	public List<SysUlFilesRecVO> searchSurveyList(SysUlFilesRecQueryCondition qc)
			throws BaseException {
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		return sysUlFilesRecService.searchList(qc);
	}

	@Override
	public void addPrjPhotos(List<SysUlFilesRecVO> list) throws BaseException {
		if (CollectionUtils.isEmpty(list)) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请选择要上传的图片!");
		}

		for (SysUlFilesRecVO sysUlFilesRecVO : list) {
			// 如果上传过，将原来的图片删除
			SysUlFilesRecQueryCondition qc = new SysUlFilesRecQueryCondition();
			// qc.setDatId(sysUlFilesRecVO.getDatId());
			qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			qc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
			qc.setCfgCd(sysUlFilesRecVO.getCfgCd());
			qc.setPkId(sysUlFilesRecVO.getPkId());
			this.sysUlFilesRecService.removeByCondition(qc);
			this.sysUlFilesRecService.add(sysUlFilesRecVO);
		}
	}

	@Override
	public CstBscInfoVO getCstTypByPrjId(Long prjId) throws BaseException {
		if (StringUtils.isEmpty(prjId)) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空！");
		}
		return CstBscInfoVOTransform.toVO(projectApiService
				.getCstTypByPrjId(prjId));
	}

	@Override
	public List<KeyValueVO> getYesNoList() throws BaseException {
		String code = DictionaryConstant.CODE_SYS_YES_NO_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getPayStlCdList() throws BaseException {
		String code = DictionaryConstant.CODE_GRP_CST_SHR_CONTR_WAY_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> getLnkTypCdList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_LNK_TYP_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> searchLsCalWayCdList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_LS_CAL_WAY_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> searchIntRateWayCdList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_INT_RATE_WAY_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public List<KeyValueVO> searchNoPayWayCdList() throws BaseException {
		String code = DictionaryConstant.CODE_PRJ_NO_PAY_WAY_CD;
		return this.getKeyValueList(code);
	}

	/*@Override
	public List<KeyValueVO> searchEquCategoryCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_AUD_EQP_MAIN_CD);
	}*/
	
	@Override
	public List<KeyValueVO> searchEquCategoryCdList(String sysCd, String orgCd)
			throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_AUD_EQP_MAIN_CD, sysCd, orgCd);
	}

	@Override
	public List<KeyValueVO> searchPayWayCdList(String sysCd, String orgCd)
			throws BaseException {
		return this.getKeyValueList("MFR0001", sysCd, orgCd);
	}

	@Override
	public List<KeyValueVO> searchCarLevelCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_AUD_CAR_LVL_CD);
	}

	@Override
	public List<KeyValueVO> searchFarmEquCategoryCdList() throws BaseException {
		return this
				.getKeyValueList(DictionaryConstant.CODE_AUD_FARM_EQP_MAIN_CD);
	}

	public List<KeyValueVO> searchInsStsCdList() throws BaseException {
		String code = DictionaryConstant.CODE_INS_STS_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public boolean addCopyCstInfoToPrjCstInfo(Long prjId) throws BaseException {
		if (StringUtils.isEmpty(prjId)) {
			return false;
		}
		return this.projectApiService.addCopyCstInfoToPrjCstInfo(prjId,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd(),
				CurrentThreadContext.getCurrentUserId());
	}

	@Override
	public Map<String, String> getDiscountRate() throws BaseException {
		Map<String, String> map = this.sysDictionaryApiService
				.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd(),
						DictionaryConstant.CODE_DISCOUNT_RATE_CD);
		return map;
	}

	@Override
	public String generateContractCode(Long prjId, String sysCd, String orgCd) {
		if (StringUtils.isEmpty(prjId)) {
			return null;
		}
		return this.projectApiService.generateContractCode(prjId, sysCd, orgCd);
	}

	@Override
	public void removeByIds(List<Long> idList,Long usrId) throws BaseException {
		if (CollectionUtils.isNotEmpty(idList)) {
			this.projectApiService.removePrjBscInfoByIds(idList,usrId);
		}
	}

	@Override
	public Document exportInvesstRpt(Long prjId, Long cstId, String cstRlCd,
			OutputStream out) throws BaseException {
		if (null == prjId) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空!");
		}
		Document document = null;
		if (StringUtils.isNotEmpty(prjId) && StringUtils.isNotEmpty(cstId)) {
			try {
				// 定义Cell边框粗细 顺序是：上下左右
				float[] borderStart = { 0.5f, 0.5f, 0.5f, 0 };
				float[] borderRight = { 0.5f, 0.5f, 0.5f, 0.5f };
				float[] borderEnd1 = { 0.5f, 0.5f, 0.5f, 0.5f };
				// 定义默认字体
				int[] fontDefault = { -1, -1 };
				int[] fontDateDefault = new int[] { 9, Font.NORMAL };
				// 定义默认边距 顺序是：上下左右
				float[] paddingDefault = { 3f, 3f, 2f, 2f };
				// 定义默认位置 水平，垂直
				int[] alignDefault = { -1, -1 };// 靠左
				int[] alignCenter = { PdfPCell.ALIGN_CENTER,
						PdfPCell.ALIGN_CENTER };// 居中
				int[] alignRight = { PdfPCell.ALIGN_RIGHT,
						PdfPCell.ALIGN_CENTER };// 靠右
				int[] alignLift = { PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_CENTER };// 靠左
				// pdf名字
				BaseFont bfChinese;
				bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",
						BaseFont.NOT_EMBEDDED);

				document = new Document(PageSize.A4, 22, 22, 30, 10); // 其余4个参数，设置了页面的4个边距
				document.setMarginMirroring(true);
				PdfWriter.getInstance(document, out);
				// 打开文档
				document.open();
				// 写入标题
				Font fontBold = new Font(bfChinese, 9, Font.BOLD);
				Font fontSmall = new Font(bfChinese, 8, Font.NORMAL);
				PdfPTable tot = new PdfPTable(10);
				CstBscInfoDTO cstInfo = customerApiService
						.selectCstBscInfoDetailById(cstId,
								CurrentThreadContext.getCurrentSysCd(),
								CurrentThreadContext.getCurrentOrgCd(),
								CurrentThreadContext.getCurrentBuOrgCd());
				if (cstInfo.getCstTypCd()
						.equals(CustomerConstant.CST_TYP_CD_NP)) {
					String title = "融资租赁业务客户申请及资信调查报告(自然人)";
					tot.addCell(PdfExportServer.createCell(bfChinese, title,
							new int[] { 12, Font.BOLD }, new float[] { 10f,
									10f, -1f, -1f }, new float[] { 0f, 0f, 0f,
									0f }, alignCenter, 10));
					document.add(tot);
					// 客户基础信息
					PdfPTable npBscCst = getNpBscCstTable(cstInfo, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(npBscCst);
					// 客户社会关系
					Pager page = new Pager();
					List<Long> cstIdList = new ArrayList<Long>();
					CstNpSocialRlQueryCondition npSocialQc = new CstNpSocialRlQueryCondition();
					cstIdList.add(cstId);
					npSocialQc.setCstIdList(cstIdList);
					page.setCurrentPage(1);
					page.setEveryPage(Integer.MAX_VALUE);
					npSocialQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					npSocialQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					page.setCondition(npSocialQc);
					Pager cstPage = this.cstNpSocialRlService
							.searchListPage(page);
					List<CstNpSocialRlVO> cstNpSocialList = null;
					if (CollectionUtils.isNotEmpty(cstPage.getResultList())) {
						cstNpSocialList = (List<CstNpSocialRlVO>) cstPage
								.getResultList();
					}
					PdfPTable npSocial = getNpSocialTable(cstNpSocialList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(npSocial);
					PrjCstOwnVehicleQueryCondition prjCstOwnQc = new PrjCstOwnVehicleQueryCondition();
					prjCstOwnQc.setCstId(cstId);
					prjCstOwnQc.setPrjId(prjId);
					List<PrjCstOwnVehicleVO> ownVehicleList = prjCstOwnVehicleService
							.searchList(prjCstOwnQc);
					PdfPTable ownVehicle = null;
					try {
						ownVehicle = getOwnVehicleTable(ownVehicleList,
								bfChinese, borderStart, borderRight,
								borderEnd1, paddingDefault, fontDateDefault,
								alignDefault, alignCenter, alignRight,
								alignLift, fontDefault);
					} catch (Exception e) {
						BaseLogUtils.newWebLogger("exportInvesstRpt").setLogOperType(LogOperEnum.REQ)
								.setSysCd(CurrentThreadContext.getCurrentSysCd())
								.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
								.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
								.setWarning(false)
								.setThrowable(e)
								.warn(LogExceptionEnum.COMMON_CODE_0001);
					}
					document.add(ownVehicle);
				}
				if (cstInfo.getCstTypCd().equals(
						CustomerConstant.CST_TYP_CD_CORP)) {
					String title = "融资租赁业务客户申请及资信调查报告(法人)";
					tot.addCell(PdfExportServer.createCell(bfChinese, title,
							new int[] { 12, Font.BOLD }, new float[] { 10f,
									10f, -1f, -1f }, new float[] { 0f, 0f, 0f,
									0f }, alignCenter, 10));
					document.add(tot);
					// 法人客户基础信息
					PdfPTable corpBscCst = getCorpBscCstTable(cstInfo,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(corpBscCst);
					// 股东
					List<Long> cstIdList = new ArrayList<Long>();
					cstIdList.add(cstId);
					CstCorpShrQueryCondition shrQc = new CstCorpShrQueryCondition();
					shrQc.setCstIdList(cstIdList);
					shrQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					shrQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					List<CstCorpShrDTO> shrList = this.customerApiService
							.searchCstCorpShr(shrQc);
					PdfPTable corpShr = getShrBscCstTable(shrList, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(corpShr);
					// 公司历史
					CstCorpHisQueryCondition cstCorpHis = new CstCorpHisQueryCondition();
					cstCorpHis.setCstId(cstId);
					List<CstCorpHisDTO> hisList = this.customerApiService
							.searchCstCorpHisList(cstCorpHis);
					PdfPTable corphis = getCorpHisTable(hisList, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(corphis);
					// 主要管理人员
					CstCorpTeamQueryCondition teamQc = new CstCorpTeamQueryCondition();
					teamQc.setCstIdList(cstIdList);
					teamQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					teamQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					List<CstCorpTeamDTO> cstCorpTeamList = this.customerApiService
							.searchCstCorpTeamList(teamQc);
					PdfPTable cstCorpTeam = getCorpTeamTable(cstCorpTeamList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(cstCorpTeam);
					Map<Long, CstCorpTeamDTO> teamMap = new HashMap<Long, CstCorpTeamDTO>();
					List<Long> memIdList = new ArrayList<Long>();
					if (CollectionUtils.isNotEmpty(cstCorpTeamList)) {
						for (CstCorpTeamDTO team : cstCorpTeamList) {
							memIdList.add(team.getId());
							teamMap.put(team.getId(), team);
						}
					}
					// 主要管理人员简历
					CstCorpTeamResumeQueryCondition resumeQc = new CstCorpTeamResumeQueryCondition();
					resumeQc.setMemIdList(memIdList);
					List<CstCorpTeamResumeDTO> resumeList = customerApiService
							.searchCstCorpTeamResumeList(resumeQc);
					PdfPTable resumeTeam = getCorpTeamResumeTable(teamMap,
							resumeList, bfChinese, borderStart, borderRight,
							borderEnd1, paddingDefault, fontDateDefault,
							alignDefault, alignCenter, alignRight, alignLift,
							fontDefault);
					document.add(resumeTeam);
					// 关联公司
					CstCorpRlCompQueryCondition corpRl = new CstCorpRlCompQueryCondition();
					corpRl.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					corpRl.setSysCd(CurrentThreadContext.getCurrentSysCd());
					corpRl.setCstIdList(cstIdList);
					List<CstCorpRlCompDTO> cstCorpRlList = this.customerApiService
							.searchCstCorpRlCompList(corpRl);
					PdfPTable cstCorpRl = getCstCorpRlCompTable(cstCorpRlList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(cstCorpRl);
					// 联络人信息
					PrjLinkManQueryCondition prjLinkManQc = new PrjLinkManQueryCondition();
					// prjLinkManQc.setCstId(cstId);
					prjLinkManQc.setPrjId(prjId);
					List<PrjLinkManVO> prjLinkManList = this.prjLinkManService
							.searchList(prjLinkManQc);
					PdfPTable prjLinkMan = getPrjLinkManTable(prjLinkManList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(prjLinkMan);

				}
				// 融资信息
				PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
				qc.setPrjId(Long.valueOf(prjId));
				List<PrjPrdBscInfoVO> prjPrdlist = this.prjPrdBscInfoService
						.searchList(qc);
				PdfPTable prjPrd = getPrjPrdTable(prjPrdlist, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault,
						CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd());
				document.add(prjPrd);
				// 担保人信息
				PrjCstBscInfoQueryCondition cstQc = new PrjCstBscInfoQueryCondition();
				cstQc.setPrjId(prjId);
				cstQc.setCstRlTyp(PrjCstBscInfoConstant.CST_Rl_ATTR_GUARANTOR);
				List<PrjCstBscInfoVO> prjCstInfoList = this.prjCstBscInfoService
						.searchList(cstQc);
				List<CstBscInfoDTO> cstList = new ArrayList<CstBscInfoDTO>();
				if (CollectionUtils.isNotEmpty(prjCstInfoList)) {
					for (PrjCstBscInfoVO prjCst : prjCstInfoList) {
						CstBscInfoDTO cst = customerApiService
								.selectCstBscInfoDetailById(prjCst.getCstId(),
										CurrentThreadContext.getCurrentSysCd(),
										CurrentThreadContext.getCurrentOrgCd(),
										CurrentThreadContext
												.getCurrentBuOrgCd());
						cstList.add(cst);
					}
				}
				PdfPTable prjCstInfo = getPrjCstTable(cstList, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(prjCstInfo);
				// 抵押担保信息
				PrjCstAssMbInfoQueryCondition assQc = new PrjCstAssMbInfoQueryCondition();
				assQc.setPrjId(prjId);
				assQc.setCstId(cstId);
				assQc.setCstRlCd(cstRlCd);
				List<PrjCstAssMbInfoVO> assList = this.prjCstAssMbInfoService
						.searchList(assQc,
								CurrentThreadContext.getCurrentSysCd(),
								CurrentThreadContext.getCurrentOrgCd());
				// 车辆设备
				List<PrjCstAssMbInfoVO> carList = new ArrayList<PrjCstAssMbInfoVO>();
				// 住房设备
				List<PrjCstAssMbInfoVO> houseList = new ArrayList<PrjCstAssMbInfoVO>();
				// 其他财产
				List<PrjCstAssMbInfoVO> othList = new ArrayList<PrjCstAssMbInfoVO>();
				if (CollectionUtils.isNotEmpty(assList)) {
					for (PrjCstAssMbInfoVO ass : assList) {
						if (ass.getAssPropCd().equals(
								PrjCstAssMbInfoConstant.CST_ASS_PROP_BUIL_CD)
								&& ass.getPrjId().compareTo(prjId) == 0
								&& ass.getCstId().compareTo(cstId) == 0) {
							houseList.add(ass);
						}
						if (ass.getAssPropCd().equals(
								PrjCstAssMbInfoConstant.CST_ASS_PROP_EQUI_CD)
								&& ass.getPrjId().compareTo(prjId) == 0
								&& ass.getCstId().compareTo(cstId) == 0) {
							carList.add(ass);
						}
						if (ass.getAssPropCd().equals(
								PrjCstAssMbInfoConstant.CST_ASS_PROP_OTH_CD)
								&& ass.getPrjId().compareTo(prjId) == 0
								&& ass.getCstId().compareTo(cstId) == 0) {
							othList.add(ass);
						}
					}
				}
				PdfPTable carInfo = getCarInfoTable(carList, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(carInfo);
				PdfPTable houseInfo = getHouseInfoTable(houseList, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(houseInfo);
				PdfPTable othInfo = getOthInfoTable(othList, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(othInfo);
				// 企业还款能力
				PrjCstRepayAbiQueryCondition abiQc = new PrjCstRepayAbiQueryCondition();
				abiQc.setPrjId(prjId);
				abiQc.setCstId(cstId);
				abiQc.setCstRlCd(cstRlCd);
				List<PrjCstRepayAbiVO> abiList = this.prjCstRepayAbiService
						.searchList(abiQc,
								CurrentThreadContext.getCurrentSysCd(),
								CurrentThreadContext.getCurrentOrgCd());// 通过项目和客户id查询客户还款能力
				PdfPTable abiInfo = getAbiInfoTable(abiList, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(abiInfo);
				// 收益分析
				PrjCstProfitAnaQueryCondition profitQc = new PrjCstProfitAnaQueryCondition();
				profitQc.setPrjId(prjId);
				profitQc.setCstId(cstId);
				List<PrjCstProfitAnaVO> profitList = this.prjCstProfitAnaService
						.searchList(profitQc);// 通过项目和客户id查询客户调查报告
				PrjCstRepayAbiVO abiVO = this.prjCstRepayAbiService
						.getPrjCstRepayAbiByPrjIdAndCstId(prjId, cstId, cstRlCd);
				PrjCstProfitAnaVO profit = null;
				if (CollectionUtils.isNotEmpty(profitList)) {
					profit = profitList.get(0);
					if (null != abiVO) {
						if (null != abiVO.getIsCrimRecd()) {
							profit.setIsCrimRecd(abiVO.getIsCrimRecd());
							profit.setIsCrimRecdNm(abiVO.getIsCrimRecdNm());
						}
						if (null != abiVO.getApyCrdtCd()) {
							profit.setApyCrdtCd(abiVO.getApyCrdtCd());
							profit.setApyCrdtCdNm(abiVO.getApyCrdtCdNm());
						}
						if (null != abiVO.getIsFinaInstAss()) {
							profit.setIsFinaInstAss(abiVO.getIsFinaInstAss());
							profit.setIsFinaInstAssNm(abiVO
									.getIsFinaInstAssNm());
						}
						if (null != abiVO.getCorpReprCrdtCd()) {
							profit.setCorpReprCrdtCd(abiVO.getCorpReprCrdtCd());
							profit.setCorpReprCrdtCdNm(abiVO
									.getCorpReprCrdtCdNm());
						}
					}
				}
				PdfPTable profitInfo = getProfitInfoTable(profit, bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(profitInfo);
				// 考察照片
				SysUlFilesRecQueryCondition surveyFileQc = new SysUlFilesRecQueryCondition();
				surveyFileQc.setPkId(String.valueOf(prjId));
				surveyFileQc.setTabNm("PRJ_BSC_INFO");
				surveyFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
				surveyFileQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
				if (cstInfo.getCstTypCd()
						.equals(CustomerConstant.CST_TYP_CD_NP)) {
					surveyFileQc
							.setCfgCd(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
				}
				if (cstInfo.getCstTypCd().equals(
						CustomerConstant.CST_TYP_CD_CORP)) {
					surveyFileQc
							.setCfgCd(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
				}
				List<SysUlFilesRecDTO> surveyFileList = this.uploadApiService
						.searchSysUlFilesRecList(surveyFileQc);
				PdfPTable surveyFile = getSurveyFileTable(surveyFileList,
						bfChinese, borderStart, borderRight, borderEnd1,
						paddingDefault, fontDateDefault, alignDefault,
						alignCenter, alignRight, alignLift, fontDefault);
				document.add(surveyFile);
				// 家访照片
				SysUlFilesRecQueryCondition visitFileQc = new SysUlFilesRecQueryCondition();
				if (cstInfo.getCstTypCd()
						.equals(CustomerConstant.CST_TYP_CD_NP)) {
					visitFileQc
							.setCfgCd(PrjBscInfoConstant.CODE_VISIT_PHOTO_NP);
				}
				if (cstInfo.getCstTypCd().equals(
						CustomerConstant.CST_TYP_CD_CORP)) {
					visitFileQc
							.setCfgCd(PrjBscInfoConstant.CODE_VISIT_PHOTO_LP);
				}
				visitFileQc.setTabNm("PRJ_BSC_INFO");
				visitFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
				visitFileQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
				visitFileQc.setPkId(String.valueOf(prjId));
				List<SysUlFilesRecDTO> visitFileList = this.uploadApiService
						.searchSysUlFilesRecList(visitFileQc);
				PdfPTable visitFile = getVisitFileTable(visitFileList,
						bfChinese, borderStart, borderRight, borderEnd1,
						paddingDefault, fontDateDefault, alignDefault,
						alignCenter, alignRight, alignLift, fontDefault);
				document.add(visitFile);
				// 访谈记录
				PrjCstEmpIntvRecQueryCondition cstEmpIntRecQc = new PrjCstEmpIntvRecQueryCondition();
				cstEmpIntRecQc.setPrjId(prjId);
				cstEmpIntRecQc.setCstId(cstId);
				cstEmpIntRecQc.setCstRlCd(cstRlCd);
				List<PrjCstEmpIntvRecVO> prjCstEmpIntRecList = prjCstEmpIntvRecService
						.searchList(cstEmpIntRecQc);
				PdfPTable prjCstEmpIntRec = getPrjCstEmpIntRecTable(
						prjCstEmpIntRecList, cstInfo.getCstTypCd(), bfChinese,
						borderStart, borderRight, borderEnd1, paddingDefault,
						fontDateDefault, alignDefault, alignCenter, alignRight,
						alignLift, fontDefault);
				document.add(prjCstEmpIntRec);
				// 承诺及签字
				PrjCstInvestRptQueryCondition rptQc = new PrjCstInvestRptQueryCondition();
				rptQc.setCstId(cstId);
				rptQc.setPrjId(prjId);
				rptQc.setCstRlCd(cstRlCd);
				List<PrjCstInvestRptVO> investRptList = this.prjCstInvestRptService
						.searchList(rptQc,
								CurrentThreadContext.getCurrentSysCd(),
								CurrentThreadContext.getCurrentOrgCd());
				PdfPTable investRpt = getInvestRptRecTable(investRptList,
						bfChinese, borderStart, borderRight, borderEnd1,
						paddingDefault, fontDateDefault, alignDefault,
						alignCenter, alignRight, alignLift, fontDefault);
				document.add(investRpt);
				// 结尾
				PdfPTable endTitle = new PdfPTable(10);
				String end = "备注：无论是否批准融资，狮桥融资租赁（中国）有限公司都将保留此客户申请及调查报告。";
				endTitle.addCell(PdfExportServer.createCell(bfChinese, end,
						new int[] { 9, Font.NORMAL }, new float[] { 10f, 10f,
								-1f, -1f }, new float[] { 0f, 0f, 0f, 0f },
						alignLift, 10));
				document.add(endTitle);

			} catch (Exception e) {
				throw new BaseException(
						BaseExceptionConstant.BASE_EXCEPTION_CODE_405_NAME,
						"导出资信报告，文件处理错误！" + e.getMessage());

			} finally {
				try {
					document.close();
				} catch (Exception e) {
					// 可能之前已经关闭过了
				}
			}
		}
		return document;
	}

	// ******************************************资信调查报告pdf格式拼接开始********************************************************************//
	// 自然人基础信息
	private PdfPTable getNpBscCstTable(CstBscInfoDTO cstInfo,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然人基础信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.setKeys("cstInfo", JSON.toJSONString(cstInfo))
				.info();
		PdfPTable npBscTable = new PdfPTable(10);
		npBscTable.setWidthPercentage(100f);
		npBscTable.addCell(PdfExportServer.createCell(bfChinese, "申请人信息",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (null != cstInfo) {

			int age = DateUtils.getYear(new Date())
					- DateUtils.getYear(cstInfo.getCstNpBscInfoDTO()
							.getBirthday());
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCstNm() != null ? cstInfo.getCstNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "性别",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getGenderCdNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getGenderCdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "年龄",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, age + "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "婚姻状况",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getMarStsCdNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getMarStsCdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "从业年限",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getWorkYrs() != null ? cstInfo
					.getCstNpBscInfoDTO().getWorkYrs().toString() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "证件号",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCertNo() != null ? cstInfo.getCertNo() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "工作单位",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getWorkPlc() != null ? cstInfo
					.getCstNpBscInfoDTO().getWorkPlc() : "", fontDateDefault,
					paddingDefault, borderStart, alignCenter, 3));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "职务",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getPosCdNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getPosCdNm() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 2));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "单位地址",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getWorkAddr() != null ? cstInfo
					.getCstNpBscInfoDTO().getWorkAddr() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 8));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "通讯地址",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getPostAddr() != null ? cstInfo
					.getCstNpBscInfoDTO().getPostAddr() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 8));
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然人基础信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.setKeys("npBscTable", JSON.toJSONString(npBscTable))
				.info();
		return npBscTable;
	}

	// 自然人社会关系
	private PdfPTable getNpSocialTable(List<CstNpSocialRlVO> cstNpSocialList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然人社会关系开始").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.setKeys("cstNpSocialList", JSON.toJSONString(cstNpSocialList))
				.info();
		PdfPTable npSocialTable = new PdfPTable(10);
		npSocialTable.setWidthPercentage(100f);
		npSocialTable.addCell(PdfExportServer.createCell(bfChinese, "社会关系情况说明",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(cstNpSocialList)) {
			npSocialTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
					"与申请人关系", fontDefault, paddingDefault, borderStart,
					alignCenter, -1));
			npSocialTable.addCell(PdfExportServer.createCell(bfChinese, "身份证号",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
					"工作/学习单位", fontDefault, paddingDefault, borderStart,
					alignCenter, 2));
			npSocialTable.addCell(PdfExportServer.createCell(bfChinese, "单位地址",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			npSocialTable.addCell(PdfExportServer.createCell(bfChinese, "联系方式",
					fontDefault, paddingDefault, borderEnd1, alignCenter, 2));
			// 数据行
			for (int i = 0; i < cstNpSocialList.size(); i++) {
				CstNpSocialRlVO social = cstNpSocialList.get(i);
				npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
						social.getRlNm() != null ? social.getRlNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
						social.getRlTypCdNm() != null ? social.getRlTypCdNm()
								: "", fontDateDefault, paddingDefault,
						borderStart, alignCenter, -1));
				npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
						social.getCertNo() != null ? social.getCertNo() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
						social.getWorkPlc() != null ? social.getWorkPlc() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
						social.getWorkAddr() != null ? social.getWorkAddr()
								: "", fontDateDefault, paddingDefault,
						borderStart, alignCenter, 2));
				npSocialTable.addCell(PdfExportServer.createCell(bfChinese,
						social.getMp() != null ? social.getMp() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, 2));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然人社会关系结束").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.setKeys("npSocialTable", JSON.toJSONString(npSocialTable))
				.info();
		return npSocialTable;
	}

	private PdfPTable getCorpHisTable(List<CstCorpHisDTO> hisList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,公司历史start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.setKeys("hisList", JSON.toJSONString(hisList))
				.info();
		PdfPTable hisTable = new PdfPTable(10);
		hisTable.setWidthPercentage(100f);
		hisTable.addCell(PdfExportServer.createCell(bfChinese, "历史沿革",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(hisList)) {
			hisTable.addCell(PdfExportServer.createCell(bfChinese, "开始时间",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			hisTable.addCell(PdfExportServer.createCell(bfChinese, "结束时间",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			hisTable.addCell(PdfExportServer.createCell(bfChinese, "变更内容",
					fontDefault, paddingDefault, borderEnd1, alignCenter, 8));
			// 数据行
			for (int i = 0; i < hisList.size(); i++) {
				CstCorpHisDTO his = hisList.get(i);
				hisTable.addCell(PdfExportServer.createCell(
						bfChinese,
						his.getStartDt() != null ? DateUtils
								.formatDateToString(his.getStartDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				hisTable.addCell(PdfExportServer.createCell(
						bfChinese,
						his.getEndDt() != null ? DateUtils.formatDateToString(
								his.getEndDt(), DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				hisTable.addCell(PdfExportServer.createCell(bfChinese,
						his.getPrjDesc() != null ? his.getPrjDesc() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, 8));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,公司历史end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.setKeys("hisTable", JSON.toJSONString(hisTable))
				.info();
		return hisTable;
	}

	private PdfPTable getInvestRptRecTable(
			List<PrjCstInvestRptVO> investRptList, BaseFont bfChinese,
			float[] borderStart, float[] borderRight, float[] borderEnd1,
			float[] paddingDefault, int[] fontDateDefault, int[] alignDefault,
			int[] alignCenter, int[] alignRight, int[] alignLift,
			int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户承诺及签字start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		int[] suggFontDefault = { -1, -1 };
		// 定义默认边距 顺序是：上下左右
		float[] suggPaddingDefault = { 3f, 3f, 2f, 2f };
		// 定义默认位置 水平，垂直
		int[] suggAlignDefault = { -1, -1 };// 靠左
		int[] suggAlignCenter = { PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_CENTER };// 居中
		int[] suggAlignRight = { PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_CENTER };// 靠右
		int[] suggAlignLift = { PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_CENTER };// 靠左
		PrjCstInvestRptVO rpt = null;
		if (CollectionUtils.isNotEmpty(investRptList)) {
			rpt = investRptList.get(0);
		}
		PdfPTable investRptTable = new PdfPTable(1);
		if (null != rpt) {
			investRptTable.setWidthPercentage(100f);
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					"调查人员意见及承诺（调查人员对内容和资料的真实性、准确性、完整性及由此所作判断的合理性负责）",
					suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignLift, -1));
			String suggStr = "意见: " + rpt.getSugg() != null ? rpt.getSugg()
					: "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					suggStr, suggFontDefault, paddingDefault, borderEnd1,
					suggAlignLift, -1));

			investRptTable
					.addCell(PdfExportServer
							.createCell(
									bfChinese,
									"承诺: "
											+ "本人承诺承租人信息已现场核实，并对承租人做了尽职调查。并现场监督了客户在租赁合同及相关法律文件上的签字用印，对其真实性进行了核实。向公司提供的承租人相关权证资料包括但不限于车辆销售发票、车辆保单、车辆登记证书、车辆钥匙及法律文件等资料和手续真实有效。若由于上述法律文件及资料真实性原因导致公司权益受到侵害，我个人愿意承担一切责任。",
									suggFontDefault, suggPaddingDefault,
									borderEnd1, suggAlignLift, 2));
			String rptTypStr = "报告类型: " + rpt.getCstRptTypCdNm() != null ? rpt
					.getCstRptTypCdNm() : "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					rptTypStr, suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignRight, -1));
			String signStr = "调查人员签字： " + rpt.getInvestor() != null ? rpt
					.getInvestor() : "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					signStr, suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignRight, -1));
			String dateStr = "日期： " + rpt.getRptDt() != null ? DateUtils
					.formatDateToString(rpt.getRptDt(), DateUtils.YYYY_MM_DD)
					: "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					dateStr, suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignRight, -1));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户承诺及签字end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return investRptTable;
	}

	private PdfPTable getPrjCstEmpIntRecTable(
			List<PrjCstEmpIntvRecVO> prjCstEmpIntRecList, String cstTypCd,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户访谈记录start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable recTable = new PdfPTable(10);
		recTable.setWidthPercentage(100f);
		recTable.addCell(PdfExportServer.createCell(bfChinese, "申请企业员工访谈记录",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(prjCstEmpIntRecList)) {
			recTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			recTable.addCell(PdfExportServer.createCell(bfChinese, "联系方式",
					fontDefault, paddingDefault, borderEnd1, alignCenter, 2));
			recTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			recTable.addCell(PdfExportServer.createCell(bfChinese, "访谈记录",
					fontDefault, paddingDefault, borderRight, alignCenter, 6));
			// 数据行
			for (int i = 0; i < prjCstEmpIntRecList.size(); i++) {
				PrjCstEmpIntvRecVO rec = prjCstEmpIntRecList.get(i);
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getNm() != null ? rec.getNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getTel() != null ? rec.getTel() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getAssRlCdNm() != null ? rec.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getCommRec() != null ? rec.getCommRec() : "",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 6));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户访谈记录end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return recTable;
	}

	private PdfPTable getVisitFileTable(List<SysUlFilesRecDTO> visitFileList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户家访start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		int width = Integer.valueOf(PropertiesCacheUtils
				.getProperty(PrjBscInfoConstant.CODE_INVEST_IMG_WIDTH));
		int heigh = Integer.valueOf(PropertiesCacheUtils
				.getProperty(PrjBscInfoConstant.CODE_INVEST_IMG_WIDTH));
		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
		String rootPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_ROOT_PATH);
		PdfPTable visitTable = new PdfPTable(4);
		visitTable.setWidthPercentage(100f);
		visitTable.addCell(PdfExportServer.createCell(bfChinese, "家访照片",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 4));
		if (CollectionUtils.isNotEmpty(visitFileList)) {
			boolean addBlankCell = false;// 是否添加空格
			int lastTime = visitFileList.size() % 4;//
			int time = visitFileList.size() / 4;// 循环的次数
			int blankCell = 0; // 空白单元格的数量
			if (lastTime != 0) {
				time = time + 1;
				addBlankCell = true;
				blankCell = 4 - lastTime;
			}
			for (int i = 1; i <= time; i++) {

				for (int k = (i - 1) * 4; k <= 4 * time; k++) {
					if (k >= (i - 1) * 4 && k < i * 4) {
						// 表头
						if (i != time) {
							SysUlFilesRecDTO titleDesc = visitFileList.get(k);
							if (k > 0 && (k + 1) % 4 == 0) {
								visitTable.addCell(PdfExportServer.createCell(
										bfChinese, titleDesc.getDatNm(),
										fontDefault, paddingDefault,
										borderEnd1, alignCenter, -1));
							} else {
								visitTable.addCell(PdfExportServer.createCell(
										bfChinese, titleDesc.getDatNm(),
										fontDefault, paddingDefault,
										borderStart, alignCenter, -1));
							}
						} else {
							// 最后一次循环
							if (k < visitFileList.size()) {
								SysUlFilesRecDTO titleDesc = visitFileList
										.get(k);
								visitTable.addCell(PdfExportServer.createCell(
										bfChinese, titleDesc.getDatNm(),
										fontDefault, paddingDefault,
										borderStart, alignCenter, -1));
							} else {
								if (k > 0 && (k + 1) % 4 == 0) {
									visitTable.addCell(PdfExportServer
											.createCell(bfChinese, " ",
													fontDefault,
													paddingDefault, borderEnd1,
													alignCenter, -1));
								} else {
									visitTable.addCell(PdfExportServer
											.createCell(bfChinese, " ",
													fontDefault,
													paddingDefault,
													borderStart, alignCenter,
													-1));
								}
							}

						}

					}

				}
				for (int j = (i - 1) * 4; j < 4 * time; j++) {
					if (j >= (i - 1) * 4 && j < i * 4) {
						if (i != time) {
							// 查询配置明细信息
							SysUlFilesRecDTO recImg = visitFileList.get(j);
							String flname = recImg.getFileNm();
							int imgType = flname.lastIndexOf(".");
							String imgTypeStr = flname.substring(imgType)
									.toLowerCase();
							// 压缩图片输出
							if (imgTypeStr.equals(".jpg")
									|| imgTypeStr.equals(".ico")
									|| imgTypeStr.equals(".jpeg")
									|| imgTypeStr.equals(".png")
									|| imgTypeStr.equals(".bmp")) {
								byte[] picture = null;
								try {
									String filePath = recImg.getFilePath();
									if (StringUtils.isNotEmpty(filePath)) {
										filePath = filePath.replace(serverPath,
												"");
										filePath = rootPath + filePath;
									}
									picture = ImageUtil.compressPictures(
											filePath, width, heigh);
									if (picture != null) {
										Image img = Image.getInstance(picture);
										img.setAlignment(1);
										visitTable.addCell(img);
									} else {
										visitTable.addCell(PdfExportServer
												.createCell(bfChinese, "暂无图片",
														fontDefault,
														paddingDefault,
														borderStart,
														alignCenter, -1));
									}
								} catch (Exception e) {
									throw new BaseException(
											BaseExceptionConstant.BASE_EXCEPTION_CODE_603,
											"图片处理错误！");
								}

							} else {
								if (j > 0 && (j + 1) % 4 == 0) {
									visitTable.addCell(PdfExportServer
											.createCell(bfChinese,
													recImg.getFileNm(),
													fontDefault,
													paddingDefault, borderEnd1,
													alignCenter, 1));
								} else {
									visitTable
											.addCell(PdfExportServer
													.createCell(bfChinese,
															recImg.getFileNm(),
															fontDefault,
															paddingDefault,
															borderStart,
															alignCenter, 1));

								}
							}

						} else {
							// 最后一次循环
							if (j < visitFileList.size()) {
								// 查询配置明细信息
								SysUlFilesRecDTO lastImg = visitFileList.get(j);
								String lastFlname = lastImg.getFileNm();
								int imgType = lastFlname.lastIndexOf(".");
								String imgTypeStr = lastFlname.substring(
										imgType).toLowerCase();
								// 压缩图片输出
								if (imgTypeStr.equals(".jpg")
										|| imgTypeStr.equals(".ico")
										|| imgTypeStr.equals(".jpeg")
										|| imgTypeStr.equals(".png")
										|| imgTypeStr.equals(".bmp")) {
									byte[] picture = null;
									try {
										String filePath = lastImg.getFilePath();
										if (StringUtils.isNotEmpty(filePath)) {
											filePath = filePath.replace(
													serverPath, "");
											filePath = rootPath + filePath;
										}
										picture = ImageUtil.compressPictures(
												filePath, width, heigh);
										if (picture != null) {
											Image img = Image
													.getInstance(picture);
											img.setAlignment(1);
											visitTable.addCell(img);
										} else {
											if (j > 0 && (j + 1) % 4 == 0) {
												visitTable
														.addCell(PdfExportServer
																.createCell(
																		bfChinese,
																		"暂无图片",
																		fontDefault,
																		paddingDefault,
																		borderEnd1,
																		alignCenter,
																		-1));
											} else {
												visitTable
														.addCell(PdfExportServer
																.createCell(
																		bfChinese,
																		"暂无图片",
																		fontDefault,
																		paddingDefault,
																		borderStart,
																		alignCenter,
																		-1));
											}
										}
									} catch (Exception e) {
										throw new BaseException(
												BaseExceptionConstant.BASE_EXCEPTION_CODE_603,
												"图片处理错误！");
									}

								} else {
									if (j > 0 && (j + 1) % 4 == 0) {
										visitTable.addCell(PdfExportServer
												.createCell(bfChinese,
														lastImg.getFileNm(),
														fontDefault,
														paddingDefault,
														borderEnd1,
														alignCenter, 1));
									} else {
										visitTable.addCell(PdfExportServer
												.createCell(bfChinese,
														lastImg.getFileNm(),
														fontDefault,
														paddingDefault,
														borderStart,
														alignCenter, 1));

									}
								}
							} else {
								if (j > 0 && (j + 1) % 4 == 0) {
									visitTable.addCell(PdfExportServer
											.createCell(bfChinese, " ",
													fontDefault,
													paddingDefault, borderEnd1,
													alignCenter, 1));
								} else {
									visitTable
											.addCell(PdfExportServer
													.createCell(bfChinese, " ",
															fontDefault,
															paddingDefault,
															borderStart,
															alignCenter, 1));

								}
							}
						}
					}
				}
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户家访end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return visitTable;

	}

	private PdfPTable getSurveyFileTable(List<SysUlFilesRecDTO> surveyFileList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) throws BadElementException,
			MalformedURLException, IOException {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户考察照片start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		int width = Integer.valueOf(PropertiesCacheUtils
				.getProperty(PrjBscInfoConstant.CODE_INVEST_IMG_WIDTH));
		int heigh = Integer.valueOf(PropertiesCacheUtils
				.getProperty(PrjBscInfoConstant.CODE_INVEST_IMG_HEIGHT));
		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
		String rootPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_ROOT_PATH);
		PdfPTable surveyTable = new PdfPTable(4);
		surveyTable.setWidthPercentage(100f);
		surveyTable.addCell(PdfExportServer.createCell(bfChinese, "考察照片",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 4));
		if (CollectionUtils.isNotEmpty(surveyFileList)) {
			boolean addBlankCell = false;// 是否添加空格
			int lastTime = surveyFileList.size() % 4;//
			int time = surveyFileList.size() / 4;// 循环的次数
			int blankCell = 0; // 空白单元格的数量
			if (lastTime != 0) {
				time = time + 1;
				addBlankCell = true;
				blankCell = 4 - lastTime;
			}
			for (int i = 1; i <= time; i++) {

				for (int k = (i - 1) * 4; k <= 4 * time; k++) {
					if (k >= (i - 1) * 4 && k < i * 4) {
						// 表头
						if (i != time) {
							SysUlFilesRecDTO titleDesc = surveyFileList.get(k);
							if (k > 0 && (k + 1) % 4 == 0) {
								surveyTable.addCell(PdfExportServer.createCell(
										bfChinese, titleDesc.getDatNm(),
										fontDefault, paddingDefault,
										borderEnd1, alignCenter, -1));
							} else {
								surveyTable.addCell(PdfExportServer.createCell(
										bfChinese, titleDesc.getDatNm(),
										fontDefault, paddingDefault,
										borderStart, alignCenter, -1));
							}
						} else {
							// 最后一次循环
							if (k < surveyFileList.size()) {
								SysUlFilesRecDTO titleDesc = surveyFileList
										.get(k);
								surveyTable.addCell(PdfExportServer.createCell(
										bfChinese, titleDesc.getDatNm(),
										fontDefault, paddingDefault,
										borderStart, alignCenter, -1));
							} else {
								if (k > 0 && (k + 1) % 4 == 0) {
									surveyTable.addCell(PdfExportServer
											.createCell(bfChinese, " ",
													fontDefault,
													paddingDefault, borderEnd1,
													alignCenter, -1));
								} else {
									surveyTable.addCell(PdfExportServer
											.createCell(bfChinese, " ",
													fontDefault,
													paddingDefault,
													borderStart, alignCenter,
													-1));
								}
							}

						}

					}

				}
				for (int j = (i - 1) * 4; j < 4 * time; j++) {
					if (j >= (i - 1) * 4 && j < i * 4) {
						if (i != time) {
							// 查询配置明细信息
							SysUlFilesRecDTO recImg = surveyFileList.get(j);
							String flname = recImg.getFileNm();
							int imgType = flname.lastIndexOf(".");
							String imgTypeStr = flname.substring(imgType)
									.toLowerCase();
							// 压缩图片输出
							if (imgTypeStr.equals(".jpg")
									|| imgTypeStr.equals(".ico")
									|| imgTypeStr.equals(".jpeg")
									|| imgTypeStr.equals(".png")
									|| imgTypeStr.equals(".bmp")) {
								byte[] picture = null;
								try {
									String filePath = recImg.getFilePath();
									if (StringUtils.isNotEmpty(filePath)) {
										filePath = filePath.replace(serverPath,
												"");
										filePath = rootPath + filePath;
									}
									// filePath = "D:\\20161225110610.jpg";
									picture = ImageUtil.compressPictures(
											filePath, width, heigh);
									if (picture != null) {
										Image img = Image.getInstance(picture);
										img.setAlignment(1);
										surveyTable.addCell(img);
									} else {
										surveyTable.addCell(PdfExportServer
												.createCell(bfChinese, "暂无图片",
														fontDefault,
														paddingDefault,
														borderStart,
														alignCenter, -1));
									}
								} catch (Exception e) {
									throw new BaseException(
											BaseExceptionConstant.BASE_EXCEPTION_CODE_603,
											"图片处理错误！");
								}

							} else {
								if (j > 0 && (j + 1) % 4 == 0) {
									surveyTable.addCell(PdfExportServer
											.createCell(bfChinese,
													recImg.getFileNm(),
													fontDefault,
													paddingDefault, borderEnd1,
													alignCenter, 1));
								} else {
									surveyTable
											.addCell(PdfExportServer
													.createCell(bfChinese,
															recImg.getFileNm(),
															fontDefault,
															paddingDefault,
															borderStart,
															alignCenter, 1));

								}
							}

						} else {
							// 最后一次循环
							if (j < surveyFileList.size()) {
								// 查询配置明细信息
								SysUlFilesRecDTO lastImg = surveyFileList
										.get(j);
								String lastFlname = lastImg.getFileNm();
								int imgType = lastFlname.lastIndexOf(".");
								String imgTypeStr = lastFlname.substring(
										imgType).toLowerCase();
								// 压缩图片输出
								if (imgTypeStr.equals(".jpg")
										|| imgTypeStr.equals(".ico")
										|| imgTypeStr.equals(".jpeg")
										|| imgTypeStr.equals(".png")
										|| imgTypeStr.equals(".bmp")) {
									byte[] picture = null;
									try {
										String filePath = lastImg.getFilePath();
										if (StringUtils.isNotEmpty(filePath)) {
											filePath = filePath.replace(
													serverPath, "");
											filePath = rootPath + filePath;
										}
										// filePath = "D:\\20161225110610.jpg";
										picture = ImageUtil.compressPictures(
												filePath, width, heigh);
										if (picture != null) {
											Image img = Image
													.getInstance(picture);
											img.setAlignment(1);
											surveyTable.addCell(img);
										} else {
											if (j > 0 && (j + 1) % 4 == 0) {
												surveyTable
														.addCell(PdfExportServer
																.createCell(
																		bfChinese,
																		"暂无图片",
																		fontDefault,
																		paddingDefault,
																		borderEnd1,
																		alignCenter,
																		-1));
											} else {
												surveyTable
														.addCell(PdfExportServer
																.createCell(
																		bfChinese,
																		"暂无图片",
																		fontDefault,
																		paddingDefault,
																		borderStart,
																		alignCenter,
																		-1));
											}
										}
									} catch (Exception e) {
										throw new BaseException(
												BaseExceptionConstant.BASE_EXCEPTION_CODE_603,
												"图片处理错误！");
									}

								} else {
									if (j > 0 && (j + 1) % 4 == 0) {
										surveyTable.addCell(PdfExportServer
												.createCell(bfChinese,
														lastImg.getFileNm(),
														fontDefault,
														paddingDefault,
														borderEnd1,
														alignCenter, 1));
									} else {
										surveyTable.addCell(PdfExportServer
												.createCell(bfChinese,
														lastImg.getFileNm(),
														fontDefault,
														paddingDefault,
														borderStart,
														alignCenter, 1));

									}
								}
							} else {
								if (j > 0 && (j + 1) % 4 == 0) {
									surveyTable.addCell(PdfExportServer
											.createCell(bfChinese, " ",
													fontDefault,
													paddingDefault, borderEnd1,
													alignCenter, 1));
								} else {
									surveyTable
											.addCell(PdfExportServer
													.createCell(bfChinese, " ",
															fontDefault,
															paddingDefault,
															borderStart,
															alignCenter, 1));

								}
							}

						}

					}

				}

			}

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户考察照片end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return surveyTable;
	}

	private PdfPTable getProfitInfoTable(PrjCstProfitAnaVO profit,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户收益分析start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable profitTable = new PdfPTable(10);
		profitTable.setWidthPercentage(100f);
		profitTable.addCell(PdfExportServer.createCell(bfChinese, "收益分析",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (null != profit) {
			profitTable.addCell(PdfExportServer.createCell(bfChinese, "拟运营线路",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getDrftOptLine() != null ? profit.getDrftOptLine()
					.toString() : "0", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese, "拟运营距离",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getDrftOptDist() != null ? profit.getDrftOptDist()
					.toString() : "0", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese, "月往返趟数",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getMonRoundTm() != null ? profit.getMonRoundTm()
					.toString() : "0", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese, "结算周期",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getSettCyl() != null ? profit.getSettCyl().toString()
					: "0", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"运输货物-去程", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getShpmetToDist() != null ? profit.getShpmetToDist()
					.toString() : "", fontDateDefault, paddingDefault,
					borderRight, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"运输货物-回程", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getShpmetCmDist() != null ? profit.getShpmetCmDist()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"载重量（吨）-去程", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getLoadWegtToDist() != null ? profit.getLoadWegtToDist()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"载重量（吨）-回程", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getLoadWegtCmDist() != null ? profit.getLoadWegtCmDist()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"运费水平（元）-去程", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getFrgtLvlToDist() != null ? profit.getFrgtLvlToDist()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"运费水平（元）-回程", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getFrgtLvlCmDist() != null ? profit.getFrgtLvlCmDist()
					.toString() : "", fontDateDefault, paddingDefault,
					borderRight, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"司机工资（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getDrvrWage() != null ? profit.getDrvrWage().toString()
					: "", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"过路过桥费（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable
					.addCell(PdfExportServer.createCell(bfChinese, profit
							.getToll() != null ? profit.getToll().toString()
							: "", fontDateDefault, paddingDefault, borderStart,
							alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese, "燃油费（元）",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getFuelCost() != null ? profit.getFuelCost().toString()
					: "", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"月保险费（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					profit.getMonPrem() != null ? profit.getMonPrem()
							.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"维修保养费用（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getMaintCost() != null ? profit.getMaintCost().toString()
					: "", fontDateDefault, paddingDefault, borderRight,
					alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"其他费用名称及金额（元）", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					profit.getOthCost() != null ? profit.getOthCost()
							.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"月净收入（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getMonNetIncm() != null ? profit.getMonNetIncm()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"月收入合计（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getTotalMonIncm() != null ? profit.getTotalMonIncm()
					.toString() : "", fontDateDefault, paddingDefault,
					borderRight, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"月支出合计（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getTotalMonExpdtr() != null ? profit.getTotalMonExpdtr()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"月均还款金额（元）", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getMonRpmtAmt() != null ? profit.getMonRpmtAmt()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"每月收入支出比例", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getMonIncmExpdtrRatio() != null ? profit
					.getMonIncmExpdtrRatio().toString() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 2));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"当地行业现状分析", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getLocalInduAnal() != null ? profit.getLocalInduAnal()
					: "", fontDateDefault, paddingDefault, borderRight,
					alignCenter, 8));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"设备运营环境简要描述", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(
					bfChinese,
					profit.getEquipOptBrifDesc() != null ? profit
							.getEquipOptBrifDesc() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 8));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"路政执法情况简述", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getHgwyLowEfmtDesc() != null ? profit.getHgwyLowEfmtDesc()
					: "", fontDateDefault, paddingDefault, borderRight,
					alignCenter, 8));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"还款来源与保障", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getRymtSourGuar() != null ? profit.getRymtSourGuar() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					8));

			profitTable.addCell(PdfExportServer.createCell(bfChinese, "风险控制措施",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getRiskCtlMeas() != null ? profit.getRiskCtlMeas() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					8));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"是否有犯罪记录或诉讼案件", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 3));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getIsCrimRecdNm() != null ? profit.getIsCrimRecdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"是否曾经被金融机构执行资产", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 3));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getIsFinaInstAssNm() != null ? profit.getIsFinaInstAssNm()
					: "", fontDateDefault, paddingDefault, borderRight,
					alignCenter, 2));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"申请企业我司信用记录", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(bfChinese, profit
					.getApyCrdtCdNm() != null ? profit.getApyCrdtCdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					3));

			profitTable.addCell(PdfExportServer.createCell(bfChinese,
					"法人代表我司信用记录", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			profitTable.addCell(PdfExportServer.createCell(
					bfChinese,
					profit.getCorpReprCrdtCdNm() != null ? profit
							.getCorpReprCrdtCdNm() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 3));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户收益分析end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return profitTable;
	}

	private PdfPTable getAbiInfoTable(List<PrjCstRepayAbiVO> abiList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户还款能力start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PrjCstRepayAbiVO abi = null;
		if (CollectionUtils.isNotEmpty(abiList)) {
			abi = abiList.get(0);
		}
		PdfPTable abiTable = new PdfPTable(10);
		abiTable.setWidthPercentage(100f);
		abiTable.addCell(PdfExportServer.createCell(bfChinese,
				"申请企业还款能力调查（财务数据以客户提报资料中最新报表为依据）", new int[] { 10, Font.BOLD },
				paddingDefault, borderEnd1, alignLift, 10));
		if (null != abi) {
			abiTable.addCell(PdfExportServer.createCell(bfChinese, "自有车辆数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getOwnCarNum() != null ? abi.getOwnCarNum().toString()
					: "0", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "管理车辆数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getMgrCarNum() != null ? abi.getMgrCarNum().toString()
					: "0", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "客户数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getCstNum() != null ? abi.getCstNum().toString() : "0",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "从业年限",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getYear() != null ? abi.getYear().toString() : "0",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "结款方式",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getPayStlCd() != null ? abi.getPayStlCdNm() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "房产土地情况",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getHsePptLandSts() != null ? abi.getHsePptLandSts() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "资产规模",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getAssScl() != null ? abi.getAssScl().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "负债",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getDebt() != null ? abi.getDebt().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "净资产",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getNetAss() != null ? abi.getNetAss().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "流动资产",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getLiqAss() != null ? abi.getLiqAss().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "固定资产",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getFixAss() != null ? abi.getFixAss().toString() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "资产负债率(%)",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getAssDebtRate() != null ? abi.getAssDebtRate().toString()
					: "", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "主营业务收入",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getMainBusiIncm() != null ? abi.getMainBusiIncm()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "净利润",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(
					bfChinese,
					abi.getNetPrft() != null ? abi.getNetPrft().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "借款频次",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getPayFrqnc() != null ? abi.getPayFrqnc().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"运输合同量占运输能力的比值", fontDateDefault, paddingDefault,
					borderStart, alignCenter, -1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getContatAbltRato() != null ? abi.getContatAbltRato()
					.toString() : "", fontDateDefault, paddingDefault,
					borderRight, alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"对外抵押担保情况说明", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getExtMbDesc() != null ? abi.getExtMbDesc() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					8));
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户还款能力end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return abiTable;
	}

	// 其他财产
	private PdfPTable getOthInfoTable(List<PrjCstAssMbInfoVO> othList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户其他财产start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable othTable = new PdfPTable(10);
		othTable.setWidthPercentage(100f);
		othTable.addCell(PdfExportServer.createCell(bfChinese, "其他财产",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(othList)) {
			othTable.addCell(PdfExportServer.createCell(bfChinese, "资产名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "购买时间",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "现估计（万元）",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "财产状况",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderEnd1, alignCenter, 2));
			// 数据行
			for (int i = 0; i < othList.size(); i++) {
				PrjCstAssMbInfoVO oth = othList.get(i);
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getAssNm() != null ? oth.getAssNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(
						bfChinese,
						oth.getPurchDt() != null ? DateUtils
								.formatDateToString(oth.getPurchDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(
						bfChinese,
						oth.getValue() != null ? oth.getValue().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getmStsCdNm() != null ? oth.getmStsCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getAssRlCdNm() != null ? oth.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, 2));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户其他财产end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return othTable;
	}

	private PdfPTable getHouseInfoTable(List<PrjCstAssMbInfoVO> houseList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户住房财产start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable houseTable = new PdfPTable(10);
		houseTable.setWidthPercentage(100f);
		houseTable.addCell(PdfExportServer.createCell(bfChinese, "住房财产",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(houseList)) {
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "面积（平米）",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "现估计（万元）",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "房屋登记号",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "所有权人",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "抵押状态",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "房屋地址",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "权属性质",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));

			// 数据行
			for (int i = 0; i < houseList.size(); i++) {
				PrjCstAssMbInfoVO house = houseList.get(i);
				houseTable.addCell(PdfExportServer.createCell(bfChinese, house
						.getArea() != null ? house.getArea().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				houseTable.addCell(PdfExportServer.createCell(bfChinese, house
						.getValue() != null ? house.getValue().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getAssNo() != null ? house.getAssNo() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getAssOwner() != null ? house.getAssOwner() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese, house
						.getAssRlCdNm() != null ? house.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getmStsCdNm() != null ? house.getmStsCdNm() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getAddr() != null ? house.getAddr() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getNatureCd() != null ? house.getNatureCd() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户住房财产end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return houseTable;
	}

	private PdfPTable getCarInfoTable(List<PrjCstAssMbInfoVO> carList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,车辆设备start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable carTable = new PdfPTable(10);
		carTable.setWidthPercentage(100f);
		carTable.addCell(PdfExportServer.createCell(bfChinese, "车辆设备",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(carList)) {
			carTable.addCell(PdfExportServer.createCell(bfChinese, "设备名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "买入价格(万元)",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "购买时间",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "所有权人",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "抵押状态",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "设备状况",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "品牌",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "号牌",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));

			// 数据行
			for (int i = 0; i < carList.size(); i++) {
				PrjCstAssMbInfoVO car = carList.get(i);
				carTable.addCell(PdfExportServer.createCell(
						bfChinese,
						car.getAssNm() != null ? car.getAssNm().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				carTable.addCell(PdfExportServer.createCell(
						bfChinese,
						car.getUntPc() != null ? car.getUntPc().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(
						bfChinese,
						car.getPurchDt() != null ? DateUtils
								.formatDateToString(car.getPurchDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssOwner() != null ? car.getAssOwner() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssRlCdNm() != null ? car.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getmStsCdNm() != null ? car.getmStsCdNm() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssSts() != null ? car.getAssSts() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getBrNm() != null ? car.getBrNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssNo() != null ? car.getAssNo() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,车辆设备end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return carTable;
	}

	// 担保人信息
	private PdfPTable getPrjCstTable(List<CstBscInfoDTO> prjCstInfoList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保人信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable prjCstTable = new PdfPTable(10);
		prjCstTable.setWidthPercentage(100f);
		prjCstTable.addCell(PdfExportServer.createCell(bfChinese, "担保人信息",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(prjCstInfoList)) {
			prjCstTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			prjCstTable.addCell(PdfExportServer.createCell(bfChinese, "担保人类型",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			prjCstTable.addCell(PdfExportServer.createCell(bfChinese, "担保人单位",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			prjCstTable.addCell(PdfExportServer.createCell(bfChinese, "担保方式",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			prjCstTable.addCell(PdfExportServer.createCell(bfChinese, "担保金额",
					fontDefault, paddingDefault, borderEnd1, alignCenter, 2));
			// 数据行
			for (int i = 0; i < prjCstInfoList.size(); i++) {
				CstBscInfoDTO cst = prjCstInfoList.get(i);
				String WorkPlc = "";
				String tel = "";
				prjCstTable.addCell(PdfExportServer.createCell(bfChinese,
						cst.getCstNm() != null ? cst.getCstNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				prjCstTable.addCell(PdfExportServer.createCell(bfChinese,
						cst.getCstTypCdNm() != null ? cst.getCstTypCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				if (cst.getCstTypCd().equals(CustomerConstant.CST_TYP_CD_NP)) {
					WorkPlc = cst.getCstNpBscInfoDTO().getWorkPlc() == null ? ""
							: cst.getCstNpBscInfoDTO().getWorkPlc();
					tel = cst.getCstNpBscInfoDTO().getMp1();
				}
				if (cst.getCstTypCd().equals(CustomerConstant.CST_TYP_CD_CORP)) {
					WorkPlc = cst.getCstCorpBscInfoDTO().getOfficeAddr() == null ? ""
							: cst.getCstCorpBscInfoDTO().getOfficeAddr();
					tel = cst.getCstCorpBscInfoDTO().getOfficeTel();
				}
				prjCstTable.addCell(PdfExportServer.createCell(bfChinese,
						WorkPlc, fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				prjCstTable.addCell(PdfExportServer.createCell(bfChinese, cst
						.getCstExtInfoDTO().getGuarTypCdNm() != null ? cst
						.getCstExtInfoDTO().getGuarTypCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				String num9Str = "";
				if (null != cst.getCstExtInfoDTO().getNum9()) {
					BigDecimal num9 = new BigDecimal(cst.getCstExtInfoDTO()
							.getNum9());
					num9Str = num9.toPlainString();
				}

				prjCstTable.addCell(PdfExportServer.createCell(bfChinese,
						num9Str, fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, 2));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保人信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return prjCstTable;
	}

	private PdfPTable getPrjPrdTable(List<PrjPrdBscInfoVO> prjPrdlist,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault, String sysCd, String orgCd) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,融资信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable prjPrdTable = new PdfPTable(10);
		prjPrdTable.setWidthPercentage(100f);
		prjPrdTable.addCell(PdfExportServer.createCell(bfChinese, "融资信息",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(prjPrdlist)) {
			Long prjId = null;
			double total = 0d;
			for (int i = 0; i < prjPrdlist.size(); i++) {
				PrjPrdBscInfoVO prjPrd = prjPrdlist.get(i);
				total = DecimalUtils.mul(prjPrd.getGuidePc(),
						prjPrd.getPrdQty());
				if (i == 0) {
					prjId = prjPrd.getPrjId();
				}
				String splNm = "";
				String contactPerson = "";
				String address = "";
				String tel = "";
				if (null != prjPrd.getSplId()) {
					SplInfoDTO spl = this.splInfoApiService
							.selectPrdSplInfonById(prjPrd.getSplId(), sysCd,
									orgCd);
					if (spl != null) {
						splNm = spl.getSplNm() != null ? spl.getSplNm() : "";
						if (CollectionUtils.isNotEmpty(spl.getRlPsnList())) {
							contactPerson = spl.getRlPsnList().get(0).getRlNm() != null ? spl
									.getRlPsnList().get(0).getRlNm()
									: "";
							tel = spl.getRlPsnList().get(0).getTel() != null ? spl
									.getRlPsnList().get(0).getTel()
									: "";
						}
						address = spl.getPostAddr() != null ? spl.getPostAddr()
								: "";
					}
					splNm = spl.getSplNm() != null ? spl.getSplNm() : "";
					if (CollectionUtils.isNotEmpty(spl.getRlPsnList())) {
						contactPerson = spl.getRlPsnList().get(0).getRlNm() != null ? spl
								.getRlPsnList().get(0).getRlNm()
								: "";
						tel = spl.getRlPsnList().get(0).getTel() != null ? spl
								.getRlPsnList().get(0).getTel() : "";
					}
					address = spl.getPostAddr() != null ? spl.getPostAddr()
							: "";
				}
				// PrdBscInfoDTO prd =
				// this.productApiService.selectPrdBscInfoById(prjPrd.getPrdId(),
				// sysCd, orgCd);
				// if(prd!=null){
				/*
				 * splNm =spl.getSplNm()!=null?spl.getSplNm():"";
				 * if(CollectionUtils.isNotEmpty(spl.getRlPsnList())){
				 * contactPerson
				 * =spl.getRlPsnList().get(0).getRlNm()!=null?spl.getRlPsnList
				 * ().get(0).getRlNm():""; tel
				 * =spl.getRlPsnList().get(0).getTel(
				 * )!=null?spl.getRlPsnList().get(0).getTel():""; } address
				 * =spl.getPostAddr()!=null?spl.getPostAddr():"";
				 */
				// }
				// 上牌地点
				String prdBrCls = "";
				String unitNm = "";
				if (prjPrd.getPrdTypCd().equals(ProductConstant.PRD_BUS_CD)
						|| prjPrd.getPrdTypCd().equals(
								ProductConstant.PRD_CAR_CD)) {
					// 客车信息
					BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客车信息start").setLogOperType(LogOperEnum.REQ)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
							.setWarning(false)
							.info();
					PrjPrdCarInfoVO car = this.prjPrdCarInfoService.selectById(prjPrd.getId());
				} else {
					BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,产品信息start").setLogOperType(LogOperEnum.REQ)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
							.setWarning(false)
							.info();
					PrjPrdTkInfoVO tk = this.prjPrdTkInfoService.selectById(prjPrd.getId());
					// 卡车信息
					if (null != tk) {
						prdBrCls = tk.getBrTypCdNm() == null ? "" : tk.getBrTypCdNm();

						BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,卡车信息start").setLogOperType(LogOperEnum.REQ)
								.setSysCd(CurrentThreadContext.getCurrentSysCd())
								.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
								.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
								.setWarning(false)
								.info();
						PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
						prjPrdDtlQc.setPrjPrdId(prjPrd.getId());
						List<PrjPrdDtlVO> dtlList = this.prjPrdDtlService
								.selectList(prjPrdDtlQc);
						if (CollectionUtils.isNotEmpty(dtlList)) {
							// 挂靠公司
							Long compId = null;
							List<String> compNmList = new ArrayList<String>();
							for (PrjPrdDtlVO dtl : dtlList) {
								if (StringUtils.isNotBlank(dtl.getLnkCompNm())) {
									if (!compNmList
											.contains(dtl.getLnkCompNm())) {
										unitNm = dtl.getLnkCompNm() + "/";
									}
									compNmList.add(dtl.getLnkCompNm());
								}
								/*
								 * if(null==dtl.getLnkCompId()){ unitNm =
								 * dtl.getLnkCompNm()+"/"; }else{
								 * if(dtl.getLnkCompId().compareTo(compId)!=0){
								 * unitNm = dtl.getLnkCompNm()+"/"; } } compId =
								 * dtl.getLnkCompId();
								 */
							}
						}
						if (unitNm.endsWith("/")) {
							unitNm = unitNm.substring(0, unitNm.length() - 1);
						}
					}
				}
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"供应商名称", fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						splNm, fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"联系人", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						contactPerson, fontDateDefault, paddingDefault,
						borderStart, alignCenter, -1));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese, "地址",
						fontDefault, paddingDefault, borderStart, alignCenter,
						-1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						address, fontDateDefault, paddingDefault, borderRight,
						alignCenter, 4));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"联系电话", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese, tel,
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"品牌类别", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prdBrCls, fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"车辆类型", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getPrdTypCdNm() != null ? prjPrd.getPrdTypCdNm()
								.toString() : "0", fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"品牌名称", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getBrCdNm() != null ? prjPrd.getBrCdNm() : "0",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 2));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"设备名称", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getPrdNm() != null ? prjPrd.getPrdNm() : "0",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 3));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"设备型号", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getPrdMdl() != null ? prjPrd.getPrdMdl()
								.toString() : "0", fontDateDefault,
						paddingDefault, borderStart, alignCenter, 3));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"是否新车", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getIsNewNm() != null ? prjPrd.getIsNewNm()
								.toString() : "0", fontDateDefault,
						paddingDefault, borderRight, alignCenter, -1));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"使用期限（月）", fontDefault, paddingDefault, borderStart,
						alignCenter, 2));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getUsedPd() != null ? prjPrd.getUsedPd()
								.toString() : "0", fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));
				/*
				 * prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
				 * "留购价" , fontDefault, paddingDefault, borderStart,alignCenter,
				 * -1)) ;
				 * prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
				 * prjPrd
				 * .getRsrvPc()!=null?DecimalUtils.convertFenToYuan(prjPrd.
				 * getRsrvPc().longValue()).toString():"0" , fontDateDefault,
				 * paddingDefault, borderStart,alignCenter, 2)) ;
				 */
				BigDecimal bd = new BigDecimal(prjPrd.getPrdAmt());
				String totalPrdAmtStr = bd.toPlainString();
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"单价（元）", fontDefault, paddingDefault, borderStart,
						alignCenter, 2));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getPrdAmt() != null ? totalPrdAmtStr : "0",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"设备数量", fontDefault, paddingDefault, borderStart,
						alignCenter, 2));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						prjPrd.getPrdQty() != null ? prjPrd.getPrdQty()
								.toString() : "0", fontDateDefault,
						paddingDefault, borderRight, alignCenter, 2));

				/*
				 * prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
				 * "单位" , fontDefault, paddingDefault, borderEnd1,alignCenter,
				 * -1)) ;
				 * prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
				 * prjPrd
				 * .getPrdUntCdNm()!=null?prjPrd.getPrdUntCdNm().toString():"0"
				 * , fontDateDefault, paddingDefault, borderRight,alignCenter,
				 * -1)) ;
				 */

				/*
				 * prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
				 * "上牌地点" , fontDefault, paddingDefault, borderEnd1,alignCenter,
				 * 2)) ;
				 * prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
				 * regAddress , fontDateDefault, paddingDefault,
				 * borderStart,alignCenter, 3)) ;
				 */

				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"挂靠单位", fontDefault, paddingDefault, borderStart,
						alignCenter, 4));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						unitNm, fontDateDefault, paddingDefault, borderRight,
						alignCenter, 6));

			}
			prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
					"设备总额（元）合计（大写）", fontDefault, paddingDefault, borderStart,
					alignCenter, 2));
			prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
					ProjectUtils.hangeToBig(total), fontDateDefault,
					paddingDefault, borderStart, alignCenter, 3));
			BigDecimal bd = new BigDecimal(total);
			String sumPrdAmtStr = bd.toPlainString();
			prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
					"设备总额（元）（小写：￥）", fontDefault, paddingDefault, borderStart,
					alignCenter, 2));
			prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
					sumPrdAmtStr, fontDateDefault, paddingDefault, borderRight,
					alignCenter, 3));
			// 查询可用的项目方案
			PrjQuatPrpsQueryCondition quatPrpsQc = new PrjQuatPrpsQueryCondition();
			quatPrpsQc.setPrjId(prjId);
			quatPrpsQc.setIsFormalPrps(BaseConstant.IS_YESNO_YES);
			List<PrjQuatPrpsVO> prjQuatPrpsList = this.prjQuatPrpsService
					.searchList(quatPrpsQc);
			if (CollectionUtils.isNotEmpty(prjQuatPrpsList)) {
				PrjQuatPrpsVO quatPrps = prjQuatPrpsList.get(0);// 项目方案
				// 查询项目方案中费用项信息
				PrjQuatPrpsFeeQueryCondition feeQc = new PrjQuatPrpsFeeQueryCondition();
				feeQc.setPrpsId(quatPrps.getId());
				List<PrjPrdPaySchDVO> feeList = new ArrayList<PrjPrdPaySchDVO>();
				List<PrjQuatPrpsFeeVO> prjFeeDetailList = this.prjQuatPrpsFeeService
						.searchList(feeQc);
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"租赁期数", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						quatPrps.getLsPd() != null ? quatPrps.getLsPd()
								.toString() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));
				int pd = ProjectUtils.getRentPeriod(quatPrps.getLsPd()
						.intValue(), Integer.valueOf(quatPrps.getLsPdUntCd()));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"租赁周期", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						Integer.valueOf(pd).toString(), fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));

				BigDecimal bigd = new BigDecimal(quatPrps.getActLsAmt());
				String actLsAmtStr = bigd.toPlainString();
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						"租赁物总价", fontDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjPrdTable.addCell(PdfExportServer.createCell(bfChinese,
						quatPrps.getActLsAmt() != null ? actLsAmtStr : "0",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));

				if (CollectionUtils.isNotEmpty(prjFeeDetailList)) {
					for (PrjQuatPrpsFeeVO fee : prjFeeDetailList) {
						if (fee.getFeeTypCd().equals(
								PrjQuatPrpsFeeConstant.PRJ_FEE_TYP_FIRST_PRC)) {
							prjPrdTable.addCell(PdfExportServer.createCell(
									bfChinese, "首付款比例", fontDefault,
									paddingDefault, borderStart, alignCenter,
									-1));
							prjPrdTable.addCell(PdfExportServer.createCell(
									bfChinese, fee.getFeePct() != null ? fee
											.getFeePct().toString() + "%" : "",
									fontDateDefault, paddingDefault,
									borderStart, alignCenter, -1));
						}
						if (fee.getFeeTypCd().equals(
								PrjQuatPrpsFeeConstant.PRJ_FEE_TYP_COLLATERAL)) {
							prjPrdTable.addCell(PdfExportServer.createCell(
									bfChinese, "保证金比例", fontDefault,
									paddingDefault, borderStart, alignCenter,
									-1));
							prjPrdTable.addCell(PdfExportServer.createCell(
									bfChinese, fee.getFeePct() != null ? fee
											.getFeePct().toString() + "%" : "",
									fontDateDefault, paddingDefault,
									borderRight, alignCenter, -1));
						}
					}
				}
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,融资信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return prjPrdTable;
	}

	private PdfPTable getPrjLinkManTable(List<PrjLinkManVO> prjLinkManList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,项目联系人信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable prjLinkManTable = new PdfPTable(10);
		prjLinkManTable.setWidthPercentage(100f);
		prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese, "联络人信息",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(prjLinkManList)) {
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
					"项目角色", fontDefault, paddingDefault, borderStart,
					alignCenter, -1));
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
					"公司职务", fontDefault, paddingDefault, borderStart,
					alignCenter, -1));
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese, "性别",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
					"身份证号", fontDefault, paddingDefault, borderStart,
					alignCenter, 2));
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
					"手机号", fontDefault, paddingDefault, borderStart,
					alignCenter, -1));
			prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
					"常住地址", fontDefault, paddingDefault, borderRight,
					alignCenter, 3));

			// 数据行
			for (int i = 0; i < prjLinkManList.size(); i++) {
				PrjLinkManVO prjLinkMan = prjLinkManList.get(i);
				prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
						prjLinkMan.getLnkTypCdNm() != null ? prjLinkMan
								.getLnkTypCdNm().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
						prjLinkMan.getLnkNm() != null ? prjLinkMan.getLnkNm()
								.toString() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));
				prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
						prjLinkMan.getPost() != null ? prjLinkMan.getPost()
								: "", fontDateDefault, paddingDefault,
						borderStart, alignCenter, -1));
				prjLinkManTable.addCell(PdfExportServer.createCell(
						bfChinese,
						prjLinkMan.getGenderCdNm() != null ? prjLinkMan
								.getGenderCdNm() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));
				prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
						prjLinkMan.getCertNo() != null ? prjLinkMan.getCertNo()
								: "", fontDateDefault, paddingDefault,
						borderEnd1, alignCenter, 2));
				prjLinkManTable.addCell(PdfExportServer.createCell(bfChinese,
						prjLinkMan.getMp() != null ? prjLinkMan.getMp() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				prjLinkManTable.addCell(PdfExportServer.createCell(
						bfChinese,
						prjLinkMan.getHomeAddr() != null ? prjLinkMan
								.getHomeAddr() : "", fontDateDefault,
						paddingDefault, borderRight, alignCenter, 3));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,项目联系人信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return prjLinkManTable;
	}

	private PdfPTable getCstCorpRlCompTable(
			List<CstCorpRlCompDTO> cstCorpRlList, BaseFont bfChinese,
			float[] borderStart, float[] borderRight, float[] borderEnd1,
			float[] paddingDefault, int[] fontDateDefault, int[] alignDefault,
			int[] alignCenter, int[] alignRight, int[] alignLift,
			int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,关联公司/合作机构start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable cstCorpRlTable = new PdfPTable(10);
		cstCorpRlTable.setWidthPercentage(100f);
		cstCorpRlTable.addCell(PdfExportServer.createCell(bfChinese,
				"关联公司/合作机构", new int[] { 10, Font.BOLD }, paddingDefault,
				borderEnd1, alignLift, 10));
		if (CollectionUtils.isNotEmpty(cstCorpRlList)) {
			cstCorpRlTable.addCell(PdfExportServer.createCell(bfChinese, "名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 8));
			cstCorpRlTable.addCell(PdfExportServer.createCell(bfChinese,
					"与申请人关系", fontDefault, paddingDefault, borderRight,
					alignCenter, 2));

			// 数据行
			for (int i = 0; i < cstCorpRlList.size(); i++) {
				CstCorpRlCompDTO cstCorpRl = cstCorpRlList.get(i);
				cstCorpRlTable.addCell(PdfExportServer.createCell(bfChinese,
						cstCorpRl.getCompNm() != null ? cstCorpRl.getCompNm()
								.toString() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, 8));
				cstCorpRlTable.addCell(PdfExportServer.createCell(bfChinese,
						cstCorpRl.getRlTypCdNm() != null ? cstCorpRl
								.getRlTypCdNm().toString() : "",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 2));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,关联公司/合作机构end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return cstCorpRlTable;
	}

	private PdfPTable getCorpTeamResumeTable(Map<Long, CstCorpTeamDTO> teamMap,
			List<CstCorpTeamResumeDTO> resumeList, BaseFont bfChinese,
			float[] borderStart, float[] borderRight, float[] borderEnd1,
			float[] paddingDefault, int[] fontDateDefault, int[] alignDefault,
			int[] alignCenter, int[] alignRight, int[] alignLift,
			int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,主要管理人员工作简历start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable resumeTable = new PdfPTable(10);
		resumeTable.setWidthPercentage(100f);
		resumeTable.addCell(PdfExportServer.createCell(bfChinese, "主要管理人员工作简历",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(resumeList)) {
			resumeTable.addCell(PdfExportServer.createCell(bfChinese, "名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			resumeTable.addCell(PdfExportServer.createCell(bfChinese, "职务",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			resumeTable.addCell(PdfExportServer.createCell(bfChinese, "开始时间",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			resumeTable.addCell(PdfExportServer.createCell(bfChinese, "结束时间",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			resumeTable.addCell(PdfExportServer.createCell(bfChinese, "任职公司",
					fontDefault, paddingDefault, borderRight, alignCenter, 3));

			// 数据行
			for (int i = 0; i < resumeList.size(); i++) {
				CstCorpTeamResumeDTO resume = resumeList.get(i);
				String name = "";
				if (teamMap.containsKey(resume.getMemId())) {
					name = teamMap.get(resume.getMemId()).getMNm();
				}
				resumeTable.addCell(PdfExportServer.createCell(bfChinese, name,
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				resumeTable.addCell(PdfExportServer.createCell(bfChinese,
						resume.getPost() != null ? resume.getPost() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				resumeTable.addCell(PdfExportServer.createCell(
						bfChinese,
						resume.getStartDt() != null ? DateUtils
								.formatDateToString(resume.getStartDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				resumeTable.addCell(PdfExportServer.createCell(
						bfChinese,
						resume.getEndDt() != null ? DateUtils
								.formatDateToString(resume.getEndDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				resumeTable.addCell(PdfExportServer.createCell(bfChinese,
						resume.getWorkPlc() != null ? resume.getWorkPlc() : "",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 3));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,主要管理人员工作简历end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return resumeTable;
	}

	private PdfPTable getCorpTeamTable(List<CstCorpTeamDTO> teamList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,主要管理人员基础信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable teamTable = new PdfPTable(10);
		teamTable.setWidthPercentage(100f);
		teamTable.addCell(PdfExportServer.createCell(bfChinese, "主要管理人员基础信息",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(teamList)) {
			teamTable.addCell(PdfExportServer.createCell(bfChinese, "职务",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			teamTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			teamTable.addCell(PdfExportServer.createCell(bfChinese, "身份证号",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			teamTable.addCell(PdfExportServer.createCell(bfChinese, "手机号",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			teamTable.addCell(PdfExportServer.createCell(bfChinese, "常住地址",
					fontDefault, paddingDefault, borderRight, alignCenter, 4));

			// 数据行
			for (int i = 0; i < teamList.size(); i++) {
				CstCorpTeamDTO team = teamList.get(i);
				teamTable.addCell(PdfExportServer.createCell(bfChinese, team
						.getCertTypCdNm() != null ? team.getCertTypCdNm()
						.toString() : "", fontDateDefault, paddingDefault,
						borderStart, alignCenter, -1));
				teamTable.addCell(PdfExportServer.createCell(bfChinese,
						team.getMNm() != null ? team.getMNm().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				teamTable.addCell(PdfExportServer.createCell(bfChinese,
						team.getCertNo() != null ? team.getCertNo() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				teamTable.addCell(PdfExportServer.createCell(bfChinese,
						team.getMp1() != null ? team.getMp1() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				teamTable.addCell(PdfExportServer.createCell(bfChinese,
						team.getHomeAddr() != null ? team.getHomeAddr() : "",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 4));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,主要管理人员基础信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return teamTable;
	}

	private PdfPTable getShrBscCstTable(List<CstCorpShrDTO> shrList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,股东及股权比例start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable shrTable = new PdfPTable(10);
		shrTable.setWidthPercentage(100f);
		shrTable.addCell(PdfExportServer.createCell(bfChinese, "股东及股权比例",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (CollectionUtils.isNotEmpty(shrList)) {
			shrTable.addCell(PdfExportServer.createCell(bfChinese, "股东名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			shrTable.addCell(PdfExportServer.createCell(bfChinese,
					"身份证号码或组织机构代码证号", fontDefault, paddingDefault, borderStart,
					alignCenter, 3));
			shrTable.addCell(PdfExportServer.createCell(bfChinese, "股权比例(%)",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			shrTable.addCell(PdfExportServer.createCell(bfChinese, "出资额（万元）",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			shrTable.addCell(PdfExportServer.createCell(bfChinese, "出资形式",
					fontDefault, paddingDefault, borderRight, alignCenter, 2));

			// 数据行
			for (int i = 0; i < shrList.size(); i++) {
				CstCorpShrDTO shr = shrList.get(i);
				shrTable.addCell(PdfExportServer.createCell(
						bfChinese,
						shr.getShrNm() != null ? shr.getShrNm().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				shrTable.addCell(PdfExportServer.createCell(bfChinese, shr
						.getCertNo() != null ? shr.getCertNo().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 3));
				shrTable.addCell(PdfExportServer.createCell(bfChinese, shr
						.getEquPropPct() != null ? shr.getEquPropPct()
						.toString() : "", fontDateDefault, paddingDefault,
						borderStart, alignCenter, -1));
				shrTable.addCell(PdfExportServer.createCell(bfChinese, shr
						.getCntrAmt() != null ? shr.getCntrAmt().toString()
						: "", fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				shrTable.addCell(PdfExportServer.createCell(bfChinese,
						shr.getContrWay() != null ? shr.getContrWay() : "",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 2));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,股东及股权比例end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return shrTable;
	}

	private PdfPTable getCorpBscCstTable(CstBscInfoDTO cstInfo,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,法人客户信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable corpBscTable = new PdfPTable(10);
		corpBscTable.setWidthPercentage(100f);
		if (null != cstInfo) {
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "申请人信息",
					new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
					alignLift, 10));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "企业姓名",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCstNm() != null ? cstInfo.getCstNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					3));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "注册资本金",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getRegCapAmt() != null ? cstInfo
					.getCstCorpBscInfoDTO().getRegCapAmt().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "员工数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getEmpQtyCd() != null ? cstInfo
					.getCstCorpBscInfoDTO().getEmpQtyCd() : "0",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "企业性质",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getCorpTypCdNm() != null ? cstInfo
					.getCstCorpBscInfoDTO().getCorpTypCdNm() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					-1));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
					"办公用房使用权面积", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getOfficeArea() != null ? cstInfo
					.getCstCorpBscInfoDTO().getOfficeArea().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "房产属性",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getPrpAttr() != null ? cstInfo
					.getCstCorpBscInfoDTO().getPrpAttr() : "", fontDateDefault,
					paddingDefault, borderStart, alignCenter, 2));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "办公电话",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getOfficeTel() != null ? cstInfo
					.getCstCorpBscInfoDTO().getOfficeTel() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					2));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "办公地址",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getOfficeAddr() != null ? cstInfo
					.getCstCorpBscInfoDTO().getOfficeAddr() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					4));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "贷款卡号",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getLoanCardNo() != null ? cstInfo
					.getCstCorpBscInfoDTO().getLoanCardNo().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "贷款卡密码",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getLoanCardPwd() != null ? cstInfo
					.getCstCorpBscInfoDTO().getLoanCardPwd() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					-1));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
					"贷款事项约定", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getLoanAss() != null ? cstInfo
					.getCstCorpBscInfoDTO().getLoanAss() : "", fontDateDefault,
					paddingDefault, borderRight, alignLift, 9));
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,法人客户信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return corpBscTable;
	}

	private PdfPTable getOwnVehicleTable(
			List<PrjCstOwnVehicleVO> ownVehicleList, BaseFont bfChinese,
			float[] borderStart, float[] borderRight, float[] borderEnd1,
			float[] paddingDefault, int[] fontDateDefault, int[] alignDefault,
			int[] alignCenter, int[] alignRight, int[] alignLift,
			int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,申请企业自有运营车辆信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable vehicleTable = new PdfPTable(10);
		vehicleTable.setWidthPercentage(100f);
		vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
				"申请企业自有运营车辆信息", new int[] { 10, Font.BOLD }, paddingDefault,
				borderEnd1, alignLift, 10));
		if (CollectionUtils.isNotEmpty(ownVehicleList)) {
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese, "购买时间",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese, "品牌",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese, "数量",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
					"购买价格（万元）", fontDefault, paddingDefault, borderStart,
					alignCenter, 2));
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
					"贷款余额（万元）", fontDefault, paddingDefault, borderStart,
					alignCenter, -1));
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese, "运载吨位",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
					"客车载客数（仅客车）", fontDefault, paddingDefault, borderEnd1,
					alignCenter, -1));

			// 数据行
			for (int i = 0; i < ownVehicleList.size(); i++) {
				PrjCstOwnVehicleVO vehicle = ownVehicleList.get(i);
				vehicleTable.addCell(PdfExportServer.createCell(
						bfChinese,
						vehicle.getBuyDt() != null ? DateUtils
								.formatDateToString(vehicle.getBuyDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
						vehicle.getBrNm() != null ? vehicle.getBrNm()
								.toString() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, 2));
				vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
						vehicle.getQty() != null ? vehicle.getQty().toString()
								: "", fontDateDefault, paddingDefault,
						borderStart, alignCenter, -1));
				vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
						vehicle.getBuyPrc() != null ? vehicle.getBuyPrc()
								.toString() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, 2));
				vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
						vehicle.getLoanBlc() != null ? vehicle.getLoanBlc()
								.toString() : "", fontDateDefault,
						paddingDefault, borderStart, alignCenter, -1));
				vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
						vehicle.getCryTng() != null ? vehicle.getCryTng()
								.toString() : "", fontDateDefault,
						paddingDefault, borderEnd1, alignCenter, -1));
				vehicleTable.addCell(PdfExportServer.createCell(bfChinese,
						vehicle.getPsgNum() != null ? vehicle.getPsgNum()
								.toString() : "", fontDateDefault,
						paddingDefault, borderEnd1, alignCenter, -1));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,申请企业自有运营车辆信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return vehicleTable;
	}

	// ******************************************资信调查报告pdf格式拼接结束********************************************************************//

	@Override
	public List<KeyValueVO> getBrTypCdList() throws BaseException {

		return this.getKeyValueList(DictionaryConstant.CODE_AUD_BR_LVL_CD);
	}

	@Override
	public List<KeyValueVO> getPrdClsCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_PRD_CLS_CD);
	}

	@Override
	public List<KeyValueVO> getBuyWayCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_BUY_WAY_CD);
	}

	@Override
	public List<KeyValueVO> getBizTypCdList() throws BaseException {
		return this
				.getKeyValueList(DictionaryConstant.CODE_GRP_SYS_BUSINESS_TYP_CD);
	}
	
	@Override
	public List<KeyValueVO> getBizTypCdDetailList() throws BaseException {
		return this
				.getKeyValueDetailList(DictionaryConstant.CODE_GRP_SYS_BUSINESS_TYP_CD);
	}

	@Override
	public JSONArray searchParentAndCurrentAllsOrgTree(Long currentOrgId,
			String cstMgrOrgCd) {
		List<Long> idList = new ArrayList<Long>();
		List<SysOrgDTO> orgList = new ArrayList<SysOrgDTO>();
		JSONArray jsonArray = new JSONArray();
		String currOrg = null;
		if (StringUtils.isNotBlank(cstMgrOrgCd)) {
			currOrg = cstMgrOrgCd;
			SysOrgDTO sys = this.sysOrgApiService.selectSysOrgByOrgCd(
					cstMgrOrgCd, CurrentThreadContext.getCurrentSysCd());
			if (null != sys) {
				idList.add(sys.getId());
			}
		} else {
			currOrg = CurrentThreadContext.getCurrentOrgCd();
			idList.add(currentOrgId);
		}
		// 当前及当前一下的组织机构
		List<SysOrgDTO> selfAndChild = this.sysOrgApiService
				.searchRecuOrgWithchildBy(idList,
						CurrentThreadContext.getCurrentSysCd());
		List<SysOrgDTO> parentOrg = new ArrayList<SysOrgDTO>();
		if (!currOrg.equals((SysOrgConstant.SYS_ORG_ORG_CD_INIT).toString())) {
			int subLength = SysCtrlCfgConstant.SYS_FILE_ORG_CD_GEN_LENGTH;// 组织架构每个部分串的长度
			int currOrgLength = currOrg.length();
			while (currOrgLength > subLength) {
				currOrgLength = currOrgLength - subLength;
				String tempOrgCd = currOrg.substring(0, currOrgLength);
				SysOrgDTO orgCd = sysOrgApiService.selectSysOrgByOrgCd(
						tempOrgCd, CurrentThreadContext.getCurrentSysCd());
				parentOrg.add(orgCd);
			}
			orgList.addAll(parentOrg);
		}
		orgList.addAll(selfAndChild);
		for (SysOrgDTO sysOrgDTO : orgList) {
			JSONObject obj = new JSONObject();
			obj.put("ischecked", false);
			obj.put("id", sysOrgDTO.getId());
			obj.put("text", sysOrgDTO.getOrgNm());
			obj.put("pid", sysOrgDTO.getOrgPid());
			obj.put("orgCd", sysOrgDTO.getOrgCd());
			obj.put("orgDispNm", sysOrgDTO.getOrgDispNm());
			jsonArray.add(obj);
		}
		JSONArray treeList = this.treeList(jsonArray,
				SysOrgConstant.SYS_ORG_CD_PID_INIT);
		return jsonArray;
	}
	
	@Override
	public JSONArray searchBuParentAndCurrentAllsOrgTree(String cstMgrOrgCd,String userId) {
		List<Long> idList = new ArrayList<Long>();
		List<SysOrgDTO> orgList = new ArrayList<SysOrgDTO>();
		JSONArray jsonArray = new JSONArray();
		List<String> currOrgList = new ArrayList<>();
		
		if(StringUtils.isNotBlank(userId) && !"1".equals(userId)){
			List<SysUsrDatAuthRDTO> list = priorityApiService.searchSysUsrDatAuthRWithOrgCdList(Long.valueOf(userId),null,CurrentThreadContext.getCurrentSysCd());
			if(CollectionUtils.isNotEmpty(list)){
				for (SysUsrDatAuthRDTO dto : list) {
					idList.add(dto.getOrgId());
					currOrgList.add(dto.getOrgCd());
				}
			}
		}else if (StringUtils.isNotBlank(cstMgrOrgCd)) {
			currOrgList.add(cstMgrOrgCd);
			SysOrgDTO sys = this.sysOrgApiService.selectSysOrgByOrgCd(
					cstMgrOrgCd, CurrentThreadContext.getCurrentSysCd());
			if (null != sys) {
				idList.add(sys.getId());
			}
		} else {
			currOrgList.add("00000001");
			List<SysOrgDTO> list = this.sysOrgApiService.searchListByOrgTypCd(CurrentThreadContext.getFlServiceSysCd());
			if(CollectionUtils.isNotEmpty(list)){
				for(SysOrgDTO dto:list){
					idList.add(dto.getId());
				}
			}
		}
		// 当前及当前一下的组织机构
		List<SysOrgDTO> selfAndChild = this.sysOrgApiService
				.searchRecuOrgWithchildBy(idList,
						CurrentThreadContext.getCurrentSysCd());
		List<String> orgCdList = new ArrayList<>();
		for (String currOrg : currOrgList) {
			if(StringUtils.isNotEmpty(currOrg)){
				if (!currOrg.equals((SysOrgConstant.SYS_ORG_ORG_CD_INIT).toString())) {
					int subLength = SysCtrlCfgConstant.SYS_FILE_ORG_CD_GEN_LENGTH;// 组织架构每个部分串的长度
					int currOrgLength = currOrg.length();
					while (currOrgLength > subLength) {
						currOrgLength = currOrgLength - subLength;
						String tempOrgCd = currOrg.substring(0, currOrgLength);
						if(!orgCdList.contains(tempOrgCd)){
							orgCdList.add(tempOrgCd);
						}
					}
				}
			}
		}
		SysOrgQueryCondition qc = new SysOrgQueryCondition();
		qc.setOrgCdList(orgCdList);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysOrgDTO> searchSysOrgList = sysOrgApiService.searchSysOrgList(qc);
		orgList.addAll(searchSysOrgList);
		orgList.addAll(selfAndChild);
        JSONArray treeList = new JSONArray();
        if(CollectionUtils.isNotEmpty(orgList)){
            for (SysOrgDTO sysOrgDTO : orgList) {
                JSONObject obj = new JSONObject();
                obj.put("ischecked", false);
                obj.put("id", sysOrgDTO.getId());
                obj.put("text", sysOrgDTO.getOrgNm());
                obj.put("pid", sysOrgDTO.getOrgPid());
                obj.put("orgCd", sysOrgDTO.getOrgCd());
                obj.put("orgDispNm", sysOrgDTO.getOrgDispNm());
                jsonArray.add(obj);
            }
             treeList = this.treeList(jsonArray,
                    SysOrgConstant.SYS_ORG_CD_PID_INIT);
        }
		return treeList;
	}


	/**
	 * 递归添加整个集合数据
	 *
	 * @param treeList
	 * @param parentId
	 * @return
	 */
	private JSONArray treeList(List treeList, Long parentId) {
		Long startTm = System.currentTimeMillis();
		List list = this.treeList1(treeList, parentId.toString());
		JSONArray rtnArray = JSONArray.fromObject(list);
		Long endTm = System.currentTimeMillis();
		return rtnArray;
	}

	/**
	 * 递归添加整个集合数据
	 *
	 * @param treeList
	 * @param parentId
	 * @return
	 */
	private List treeList1(List<Map<String, Object>> treeList, String parentId) {
		List childMenu = new ArrayList();
		for (Map object : treeList) {
			String oid = object.get("id").toString();
			String pid = object.get("pid").toString();
			if (parentId.equals(pid)) {
				List c_node = treeList1(treeList, oid);
				object.put("children", c_node);
				childMenu.add(object);
			}
		}
		return childMenu;
	}

	/**
	 * 验证客户的必填项是否填写
	 */
	public boolean checkCstRequiredField(Long cstId) throws BaseException {
		boolean flag = true;
		CstBscInfoDTO cstInfo = customerApiService.selectCstBscInfoDetailById(
				cstId, CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd(),
				CurrentThreadContext.getCurrentBuOrgCd());
		if (null == cstInfo) {
			return false;
		}
		if (cstInfo.getCstTypCd().equals(CustomerConstant.CST_TYP_CD_NP)) {
			// 自然人
			if (StringUtils.isBlank(cstInfo.getCstNm())) { // 客户名称
				return false;
			}
			/*
			 * if(CollectionUtils.isEmpty(cstInfo.getCstRlAttrDTOList())) return
			 * false;//客户关系
			 */if (StringUtils.isBlank(cstInfo.getCertNo()))
				return false;// 客户证件号
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getMp1()))
				return false;// 客户手机号1
			if (null == (cstInfo.getCstNpBscInfoDTO().getBirthday()))
				return false;// 客户生日
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getMarStsCd()))
				return false;// 客户婚姻状态
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getHighDgCd()))
				return false;// 客户学历
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getLivCndCd()))
				return false;// 客户居住状况
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getEmail()))
				return false;// 客户电子邮箱
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getCstLvlCd()))
				return false;// 客户分级
			if (StringUtils.isEmpty(cstInfo.getCstNpBscInfoDTO().getYrInc()))
				return false;// 客户年收入
			if (StringUtils
					.isBlank(cstInfo.getCstNpBscInfoDTO().getOfficeZip()))
				return false;// 客户单位地址邮编
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getWorkStYr()))
				return false;// 客户单位起始年份
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getHomeZip()))
				return false;// 客户居住地邮编
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getIdAddr()))
				return false;// 客户户口所在地
			if (StringUtils.isBlank(cstInfo.getCstNpBscInfoDTO().getHomeAddr()))
				return false;// 客户居住地址
		}
		if (cstInfo.getCstTypCd().equals(CustomerConstant.CST_TYP_CD_CORP)) {
			// 法人
			if (StringUtils.isBlank(cstInfo.getCstNm()))
				return false; // 企业名称
			/*
			 * if(CollectionUtils.isEmpty(cstInfo.getCstRlAttrDTOList())) return
			 * false;//客户关系
			 */if (StringUtils.isBlank(cstInfo.getCertNo()))
				return false;// 客户证件号
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getCstCorpTeamDTO().getMNm()))
				return false;// 法人代表
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getCstCorpTeamDTO().getCertNo()))
				return false;// 法人代表身份证
			if (null == (cstInfo.getCstCorpBscInfoDTO().getRegCapAmt()))
				return false;// 法人代表身份证
			if (null == (cstInfo.getCstCorpBscInfoDTO().getRegDt()))
				return false;// 成立日期
			if (null == (cstInfo.getCstCorpBscInfoDTO().getExpDt()))
				return false;// 经营日期
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO().getRegTel()))
				return false;// 注册电话
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getOfficeTel()))
				return false;// 办公电话
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO().getZipNo()))
				return false;// 通讯地址邮编
			if (StringUtils.isEmpty(cstInfo.getCstCorpBscInfoDTO().getIsInst()))
				return false;// 是否是事业单位
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getPerMitNo()))
				return false;// 开户许可证号
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getStdIndCd()))
				return false;// 经济行业分类
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getRegProvCd()))
				return false;// 省
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getRegCityCd()))
				return false;// 市
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getRegDistCd()))
				return false;// 县
			if (StringUtils
					.isBlank(cstInfo.getCstCorpBscInfoDTO().getRegAddr()))
				return false;// 注册地址
			if (StringUtils.isBlank(cstInfo.getCstCorpBscInfoDTO()
					.getPostAddr()))
				return false;// 通信地址
		}
		return flag;
	}

	@Override
	public List<KeyValueVO> getPrdStsCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_PRJ_PRD_STS_CD);
	}

	@Override
	public JSONArray searchPrjIndTree() throws BaseException {
		JSONArray jsonArray = new JSONArray();
		List<SysDictionaryDTO> dicList = this.sysDictionaryApiService
				.searchGroup(CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd(),
						DictionaryConstant.CODE_PRJ_IND_CD);
		for (SysDictionaryDTO dict : dicList) {
			JSONObject obj = new JSONObject();
			obj.put("ischecked", false);
			obj.put("id", dict.getCode());
			obj.put("text", dict.getCodeNm());
			obj.put("pid", dict.getPCode());
			obj.put("key", dict.getCode());
			obj.put("value", dict.getCodeNm());
			jsonArray.add(obj);
		}
		JSONArray treeList = this.treeIndList(jsonArray,
				PrjBscInfoConstant.SYS_IND_CD_PID_INIT);
		return treeList;
	}

	private JSONArray treeIndList(JSONArray treeList, String parentId) {
		JSONArray childMenu = new JSONArray();
		for (Object object : treeList) {
			JSONObject jsonMenu = JSONObject.fromObject(object);
			String oid = jsonMenu.getString("id");
			String pid = jsonMenu.getString("pid");
			if (parentId.equals(pid)) {
				JSONArray c_node = treeIndList(treeList, oid);
				jsonMenu.put("children", c_node);
				childMenu.add(jsonMenu);
			}
		}
		return childMenu;
	}

	@Override
	public List<PrjBscInfoVO> getPrjBscInfoByPrjNm(String prjNm)
			throws BaseException {
		if (StringUtils.isNotBlank(prjNm)) {
			return PrjBscInfoVOTransform.toVOList(this.projectApiService
					.getPrjBscInfoByPrjNm(prjNm));
		}
		return null;
	}

	public Document exportGuarInvesstRpt(Long prjId, Long cstId, Long prjCstId,
			String cstRlCd, OutputStream out) throws BaseException {
		if (null == prjId) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空!");
		}
		Document document = null;
		if (StringUtils.isNotEmpty(prjId) && StringUtils.isNotEmpty(cstId)) {
			try {
				// 定义Cell边框粗细 顺序是：上下左右
				float[] borderStart = { 0.5f, 0.5f, 0.5f, 0 };
				float[] borderRight = { 0.5f, 0.5f, 0.5f, 0.5f };
				float[] borderEnd = { 0.5f, 0, 0.5f, 0.5f };
				float[] borderFootRight = { 0.5f, 0.5f, 0.5f, 0.5f };
				float[] borderStart1 = { 0.5f, 0.5f, 0.5f, 0 };
				float[] borderEnd1 = { 0.5f, 0.5f, 0.5f, 0.5f };
				float[] borderStart2 = { 0, 0.5f, 0.5f, 0 };
				float[] borderStart3 = { 0, 0.5f, 0.5f, 0.5f };
				// 定义默认字体
				int[] fontDefault = { -1, -1 };
				int[] fontDateDefault = new int[] { 9, Font.NORMAL };
				// 定义默认边距 顺序是：上下左右
				float[] paddingDefault = { 3f, 3f, 2f, 2f };
				// 定义默认位置 水平，垂直
				int[] alignDefault = { -1, -1 };// 靠左
				int[] alignCenter = { PdfPCell.ALIGN_CENTER,
						PdfPCell.ALIGN_CENTER };// 居中
				int[] alignRight = { PdfPCell.ALIGN_RIGHT,
						PdfPCell.ALIGN_CENTER };// 靠右
				int[] alignLift = { PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_CENTER };// 靠左
				// pdf名字
				BaseFont bfChinese;
				bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",
						BaseFont.NOT_EMBEDDED);

				document = new Document(PageSize.A4, 22, 22, 30, 10); // 其余4个参数，设置了页面的4个边距
				document.setMarginMirroring(true);
				PdfWriter.getInstance(document, out);
				// 打开文档
				document.open();
				// 写入标题
				Font fontBold = new Font(bfChinese, 9, Font.BOLD);
				Font fontSmall = new Font(bfChinese, 8, Font.NORMAL);
				PdfPTable tot = new PdfPTable(10);
				CstBscInfoDTO cstInfo = customerApiService
						.selectCstBscInfoDetailById(cstId,
								CurrentThreadContext.getCurrentSysCd(),
								CurrentThreadContext.getCurrentOrgCd(),
								CurrentThreadContext.getCurrentBuOrgCd());
				if (cstInfo.getCstTypCd()
						.equals(CustomerConstant.CST_TYP_CD_NP)) {
					String title = "融资租赁业务担保人资信调查报告(自然人)";
					tot.addCell(PdfExportServer.createCell(bfChinese, title,
							new int[] { 12, Font.BOLD }, new float[] { 10f,
									10f, -1f, -1f }, new float[] { 0f, 0f, 0f,
									0f }, alignCenter, 10));
					document.add(tot);
					// 客户基础信息
					PdfPTable npBscCst = getGuarNpBscCstTable(cstInfo,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(npBscCst);
					// 家庭财产情况
					PdfPTable assTitleTable = new PdfPTable(10);
					assTitleTable.setWidthPercentage(100f);
					assTitleTable.addCell(PdfExportServer.createCell(bfChinese,
							"家庭财产情况", new int[] { 10, Font.BOLD },
							paddingDefault, borderEnd1, alignLift, 10));
					document.add(assTitleTable);
					PrjCstAssMbInfoQueryCondition assQc = new PrjCstAssMbInfoQueryCondition();
					assQc.setPrjId(prjId);
					assQc.setCstId(cstId);
					assQc.setCstRlCd(cstRlCd);
					List<PrjCstAssMbInfoVO> assList = this.prjCstAssMbInfoService
							.searchList(assQc,
									CurrentThreadContext.getCurrentSysCd(),
									CurrentThreadContext.getCurrentOrgCd());
					// 车辆设备
					List<PrjCstAssMbInfoVO> carList = new ArrayList<PrjCstAssMbInfoVO>();
					// 住房设备
					List<PrjCstAssMbInfoVO> houseList = new ArrayList<PrjCstAssMbInfoVO>();
					// 其他财产
					List<PrjCstAssMbInfoVO> othList = new ArrayList<PrjCstAssMbInfoVO>();
					if (CollectionUtils.isNotEmpty(assList)) {
						for (PrjCstAssMbInfoVO ass : assList) {
							if (ass.getAssPropCd()
									.equals(PrjCstAssMbInfoConstant.CST_ASS_PROP_BUIL_CD)
									&& ass.getPrjId().compareTo(prjId) == 0
									&& ass.getCstId().compareTo(cstId) == 0) {
								houseList.add(ass);
							}
							if (ass.getAssPropCd()
									.equals(PrjCstAssMbInfoConstant.CST_ASS_PROP_EQUI_CD)
									&& ass.getPrjId().compareTo(prjId) == 0
									&& ass.getCstId().compareTo(cstId) == 0) {
								carList.add(ass);
							}
							if (ass.getAssPropCd()
									.equals(PrjCstAssMbInfoConstant.CST_ASS_PROP_OTH_CD)
									&& ass.getPrjId().compareTo(prjId) == 0
									&& ass.getCstId().compareTo(cstId) == 0) {
								othList.add(ass);
							}
						}
					}
					PdfPTable carInfo = getGuarCarInfoTable(carList, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(carInfo);
					PdfPTable houseInfo = getGuarHouseInfoTable(houseList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(houseInfo);
					PdfPTable othInfo = getGuarOthInfoTable(othList, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(othInfo);
					// 客户社会关系
					Pager page = new Pager();
					List<Long> cstIdList = new ArrayList<Long>();
					CstNpSocialRlQueryCondition npSocialQc = new CstNpSocialRlQueryCondition();
					cstIdList.add(cstId);
					npSocialQc.setCstIdList(cstIdList);
					page.setCurrentPage(1);
					page.setEveryPage(Integer.MAX_VALUE);
					npSocialQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					npSocialQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					page.setCondition(npSocialQc);
					Pager cstPage = this.cstNpSocialRlService
							.searchListPage(page);
					List<CstNpSocialRlVO> cstNpSocialList = null;
					if (CollectionUtils.isNotEmpty(cstPage.getResultList())) {
						cstNpSocialList = (List<CstNpSocialRlVO>) cstPage
								.getResultList();
					}
					PdfPTable npSocial = getNpSocialTable(cstNpSocialList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(npSocial);
					// 自然担保人还款能力说明
					PrjCstRepayAbiVO abi = this.prjCstRepayAbiService
							.getPrjCstRepayAbiByPrjIdAndCstId(prjId, cstId,
									cstRlCd);// 通过项目和客户id查询客户还款能力
					PdfPTable abiInfo = getGuarNpAbiInfoTable(abi, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(abiInfo);
					// 访谈记录
					PrjCstEmpIntvRecQueryCondition cstEmpIntRecQc = new PrjCstEmpIntvRecQueryCondition();
					cstEmpIntRecQc.setPrjId(prjId);
					cstEmpIntRecQc.setCstId(cstId);
					cstEmpIntRecQc.setCstRlCd(cstRlCd);
					List<PrjCstEmpIntvRecVO> prjCstEmpIntRecList = prjCstEmpIntvRecService
							.searchList(cstEmpIntRecQc);
					PdfPTable prjCstEmpIntRec = getGuarNpPrjCstEmpIntRecTable(
							prjCstEmpIntRecList, cstInfo.getCstTypCd(),
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(prjCstEmpIntRec);
					// 考察照片
					SysUlFilesRecQueryCondition surveyFileQc = new SysUlFilesRecQueryCondition();
					surveyFileQc.setPkId(String.valueOf(prjCstId));
					surveyFileQc.setTabNm("PRJ_CST_BSC_INFO");
					surveyFileQc
							.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
					surveyFileQc.setSysCd(CurrentThreadContext
							.getCurrentSysCd());
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_NP)) {
						surveyFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_NP);
					}
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_CORP)) {
						surveyFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_LP);
					}
					List<SysUlFilesRecDTO> surveyFileList = this.uploadApiService
							.searchSysUlFilesRecList(surveyFileQc);
					PdfPTable surveyFile = getSurveyFileTable(surveyFileList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(surveyFile);
					// 考察照片注意事项描述
					// 定义默认边距 顺序是：上下左右
					float[] suggPaddingDefault = { 3f, 3f, 2f, 2f };
					// 定义默认位置 水平，垂直
					int[] suggAlignDefault = { -1, -1 };// 靠左
					int[] suggAlignCenter = { PdfPCell.ALIGN_CENTER,
							PdfPCell.ALIGN_CENTER };// 居中
					int[] suggAlignRight = { PdfPCell.ALIGN_RIGHT,
							PdfPCell.ALIGN_CENTER };// 靠右
					int[] suggAlignLift = { PdfPCell.ALIGN_LEFT,
							PdfPCell.ALIGN_CENTER };// 靠左
					int[] suggFontDefault = { -1, -1 };
					PdfPTable surveyTot = new PdfPTable(10);
					surveyTot.setWidthPercentage(100f);
					String surveyDesc = "注：如果自然人担保人配偶在异地，调查人员必须于现场电话核实购车的真实意愿，不能在调查现场签字的需上报重卡事业部，由重卡事 业部协调客户所在地市场部人员进行面签、拍照合影，或由代理商安排其考察人员进行面签、拍照合影";
					surveyTot.addCell(PdfExportServer.createCell(bfChinese,
							surveyDesc, suggFontDefault, suggPaddingDefault,
							borderEnd1, suggAlignRight, 10));
					document.add(surveyTot);

					// 家访照片
					SysUlFilesRecQueryCondition visitFileQc = new SysUlFilesRecQueryCondition();
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_NP)) {
						visitFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_VISIT_PHOTO_NP);
					}
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_CORP)) {
						visitFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_VISIT_PHOTO_LP);
					}
					visitFileQc.setTabNm("PRJ_CST_BSC_INFO");
					visitFileQc
							.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
					visitFileQc
							.setSysCd(CurrentThreadContext.getCurrentSysCd());
					visitFileQc.setPkId(String.valueOf(prjCstId));
					List<SysUlFilesRecDTO> visitFileList = this.uploadApiService
							.searchSysUlFilesRecList(visitFileQc);
					PdfPTable visitFile = getVisitFileTable(visitFileList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(visitFile);
				}
				if (cstInfo.getCstTypCd().equals(
						CustomerConstant.CST_TYP_CD_CORP)) {
					String title = "融资租赁业务客户申请及资信调查报告(法人)";
					tot.addCell(PdfExportServer.createCell(bfChinese, title,
							new int[] { 12, Font.BOLD }, new float[] { 10f,
									10f, -1f, -1f }, new float[] { 0f, 0f, 0f,
									0f }, alignCenter, 10));
					document.add(tot);
					// 法人客户基础信息
					PdfPTable corpBscCst = getGuarCorpBscCstTable(cstInfo,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(corpBscCst);
					// 股东
					List<Long> cstIdList = new ArrayList<Long>();
					cstIdList.add(cstId);
					CstCorpShrQueryCondition shrQc = new CstCorpShrQueryCondition();
					shrQc.setCstIdList(cstIdList);
					shrQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					shrQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					List<CstCorpShrDTO> shrList = this.customerApiService
							.searchCstCorpShr(shrQc);
					PdfPTable corpShr = getShrBscCstTable(shrList, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(corpShr);
					// 股东之间关系
					PdfPTable shrRelTable = new PdfPTable(10);
					shrRelTable.setWidthPercentage(100f);
					shrRelTable.addCell(PdfExportServer.createCell(bfChinese,
							"股东间关系", fontDateDefault, paddingDefault,
							borderStart, alignCenter, -1));
					shrRelTable.addCell(PdfExportServer
							.createCell(bfChinese, cstInfo.getCstExtInfoDTO()
									.getMchr9() != null ? cstInfo
									.getCstExtInfoDTO().getMchr9() : "",
									fontDateDefault, paddingDefault,
									borderEnd1, alignCenter, 9));
					document.add(shrRelTable);
					// 公司历史
					CstCorpHisQueryCondition cstCorpHis = new CstCorpHisQueryCondition();
					cstCorpHis.setCstId(cstId);
					List<CstCorpHisDTO> hisList = this.customerApiService
							.searchCstCorpHisList(cstCorpHis);
					PdfPTable corphis = getCorpHisTable(hisList, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(corphis);
					// 主要管理人员
					CstCorpTeamQueryCondition teamQc = new CstCorpTeamQueryCondition();
					teamQc.setCstIdList(cstIdList);
					teamQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					teamQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					List<CstCorpTeamDTO> cstCorpTeamList = this.customerApiService
							.searchCstCorpTeamList(teamQc);
					PdfPTable cstCorpTeam = getCorpTeamTable(cstCorpTeamList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(cstCorpTeam);
					Map<Long, CstCorpTeamDTO> teamMap = new HashMap<Long, CstCorpTeamDTO>();
					List<Long> memIdList = new ArrayList<Long>();
					if (CollectionUtils.isNotEmpty(cstCorpTeamList)) {
						for (CstCorpTeamDTO team : cstCorpTeamList) {
							memIdList.add(team.getId());
							teamMap.put(team.getId(), team);
						}
					}
					// 主要管理人员简历
					CstCorpTeamResumeQueryCondition resumeQc = new CstCorpTeamResumeQueryCondition();
					resumeQc.setMemIdList(memIdList);
					List<CstCorpTeamResumeDTO> resumeList = customerApiService
							.searchCstCorpTeamResumeList(resumeQc);
					PdfPTable resumeTeam = getCorpTeamResumeTable(teamMap,
							resumeList, bfChinese, borderStart, borderRight,
							borderEnd1, paddingDefault, fontDateDefault,
							alignDefault, alignCenter, alignRight, alignLift,
							fontDefault);
					document.add(resumeTeam);
					// 关联公司
					CstCorpRlCompQueryCondition corpRl = new CstCorpRlCompQueryCondition();
					corpRl.setCstIdList(cstIdList);
					corpRl.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					corpRl.setSysCd(CurrentThreadContext.getCurrentSysCd());
					List<CstCorpRlCompDTO> cstCorpRlList = this.customerApiService
							.searchCstCorpRlCompList(corpRl);
					PdfPTable cstCorpRl = getCstCorpRlCompTable(cstCorpRlList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(cstCorpRl);

					// 企业还款能力
					PrjCstRepayAbiVO abi = this.prjCstRepayAbiService
							.getPrjCstRepayAbiByPrjIdAndCstId(prjId, cstId,
									cstRlCd);
					PdfPTable abiInfo = getGuarCorpAbiInfoTable(abi, bfChinese,
							borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(abiInfo);

					// 访谈记录
					PrjCstEmpIntvRecQueryCondition cstEmpIntRecQc = new PrjCstEmpIntvRecQueryCondition();
					cstEmpIntRecQc.setPrjId(prjId);
					cstEmpIntRecQc.setCstId(cstId);
					cstEmpIntRecQc.setCstRlCd(cstRlCd);
					List<PrjCstEmpIntvRecVO> prjCstEmpIntRecList = prjCstEmpIntvRecService
							.searchList(cstEmpIntRecQc);
					PdfPTable prjCstEmpIntRec = getPrjCstEmpIntRecTable(
							prjCstEmpIntRecList, cstInfo.getCstTypCd(),
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(prjCstEmpIntRec);
					// 考察照片
					SysUlFilesRecQueryCondition surveyFileQc = new SysUlFilesRecQueryCondition();
					surveyFileQc.setPkId(prjCstId.toString());
					surveyFileQc.setTabNm("PRJ_CST_BSC_INFO");
					surveyFileQc
							.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
					surveyFileQc.setSysCd(CurrentThreadContext
							.getCurrentSysCd());
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_NP)) {
						surveyFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_NP);
					}
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_CORP)) {
						surveyFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_LP);
					}
					List<SysUlFilesRecDTO> surveyFileList = this.uploadApiService
							.searchSysUlFilesRecList(surveyFileQc);
					PdfPTable surveyFile = getSurveyFileTable(surveyFileList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(surveyFile);
					// 家访照片
					SysUlFilesRecQueryCondition visitFileQc = new SysUlFilesRecQueryCondition();
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_NP)) {
						visitFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_VISIT_PHOTO_NP);
					}
					if (cstInfo.getCstTypCd().equals(
							CustomerConstant.CST_TYP_CD_CORP)) {
						visitFileQc
								.setCfgCd(PrjBscInfoConstant.CODE_GUAR_VISIT_PHOTO_LP);
					}
					visitFileQc.setTabNm("PRJ_CST_BSC_INFO");
					visitFileQc
							.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
					visitFileQc
							.setSysCd(CurrentThreadContext.getCurrentSysCd());
					visitFileQc.setPkId(String.valueOf(prjCstId));
					List<SysUlFilesRecDTO> visitFileList = this.uploadApiService
							.searchSysUlFilesRecList(visitFileQc);
					PdfPTable visitFile = getVisitFileTable(visitFileList,
							bfChinese, borderStart, borderRight, borderEnd1,
							paddingDefault, fontDateDefault, alignDefault,
							alignCenter, alignRight, alignLift, fontDefault);
					document.add(visitFile);
				}
				// 承诺及签字
				PrjCstInvestRptVO invest = this.prjCstInvestRptService
						.getPrjCstInvestRptByPrjIdAndCstId(prjId, cstId,
								cstRlCd);
				PdfPTable investRpt = getGuarInvestRptRecTable(invest,
						bfChinese, borderStart, borderRight, borderEnd1,
						paddingDefault, fontDateDefault, alignDefault,
						alignCenter, alignRight, alignLift, fontDefault);
				document.add(investRpt);
				PdfPTable endTitle = new PdfPTable(10);
				// 结尾
				String end = "备注：无论是否批准融资，狮桥融资租赁（中国）有限公司都将保留此担保人调查报告。";
				endTitle.addCell(PdfExportServer.createCell(bfChinese, end,
						new int[] { 9, Font.NORMAL }, new float[] { 10f, 10f,
								-1f, -1f }, new float[] { 0f, 0f, 0f, 0f },
						alignLift, 10));
				document.add(endTitle);

			} catch (Exception e) {
				throw new BaseException(
						BaseExceptionConstant.BASE_EXCEPTION_CODE_405_NAME,
						"导出资信报告，文件处理错误！" + e.getMessage());

			} finally {
				try {
					document.close();
				} catch (Exception e) {
					// 可能之前已经关闭过了
				}
			}
		}
		return document;
	}

	// ------------------------------------------------------
	// 担保人资信信息-------------------------------------------------------------------//

	// 自然人基础信息
	private PdfPTable getGuarNpBscCstTable(CstBscInfoDTO cstInfo,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然担保人客户信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable npBscTable = new PdfPTable(10);
		npBscTable.setWidthPercentage(100f);
		npBscTable.addCell(PdfExportServer.createCell(bfChinese, "担保人信息",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (null != cstInfo) {

			int age = DateUtils.getYear(new Date())
					- DateUtils.getYear(cstInfo.getCstNpBscInfoDTO()
							.getBirthday());
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCstNm() != null ? cstInfo.getCstNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "曾用名",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getUsedNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getUsedNm() : "", fontDateDefault,
					paddingDefault, borderStart, alignCenter, -1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "性别",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getGenderCdNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getGenderCdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "年龄",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, age + "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "民族",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getNation() != null ? cstInfo
					.getCstNpBscInfoDTO().getNation() : "", fontDateDefault,
					paddingDefault, borderEnd1, alignCenter, -1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "证件号",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCertNo() != null ? cstInfo.getCertNo() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "手机号码",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCertNo() != null ? cstInfo.getCertNo() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "工作单位",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getWorkPlc() != null ? cstInfo
					.getCstNpBscInfoDTO().getWorkPlc() : "", fontDateDefault,
					paddingDefault, borderEnd1, alignCenter, 3));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "职务",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getPosCdNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getPosCdNm() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 2));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "单位地址",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getWorkAddr() != null ? cstInfo
					.getCstNpBscInfoDTO().getWorkAddr() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 8));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "驾照类型",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getDrvLicTyp() != null ? cstInfo
					.getCstNpBscInfoDTO().getDrvLicTyp() : "", fontDateDefault,
					paddingDefault, borderStart, alignCenter, -1));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "通讯地址",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getPostAddr() != null ? cstInfo
					.getCstNpBscInfoDTO().getPostAddr() : "", fontDateDefault,
					paddingDefault, borderRight, alignCenter, 8));

			npBscTable.addCell(PdfExportServer.createCell(bfChinese, "婚姻状况",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			npBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstNpBscInfoDTO().getMarStsCdNm() != null ? cstInfo
					.getCstNpBscInfoDTO().getMarStsCdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然担保人客户信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return npBscTable;
	}

	private PdfPTable getGuarCarInfoTable(List<PrjCstAssMbInfoVO> carList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然担保人车辆设备start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable carTable = new PdfPTable(10);
		carTable.setWidthPercentage(100f);
		carTable.addCell(PdfExportServer.createCell(bfChinese, "车辆设备",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignCenter, 10));
		if (CollectionUtils.isNotEmpty(carList)) {
			carTable.addCell(PdfExportServer.createCell(bfChinese, "设备名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "买入价格(万元)",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "购买时间",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "所有权人",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "抵押状态",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			carTable.addCell(PdfExportServer.createCell(bfChinese, "设备状况",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));

			// 数据行
			for (int i = 0; i < carList.size(); i++) {
				PrjCstAssMbInfoVO car = carList.get(i);
				carTable.addCell(PdfExportServer.createCell(
						bfChinese,
						car.getAssNm() != null ? car.getAssNm().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				carTable.addCell(PdfExportServer.createCell(
						bfChinese,
						car.getUntPc() != null ? car.getUntPc().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(
						bfChinese,
						car.getPurchDt() != null ? DateUtils
								.formatDateToString(car.getPurchDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssOwner() != null ? car.getAssOwner() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssRlCdNm() != null ? car.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getmStsCdNm() != null ? car.getmStsCdNm() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
				carTable.addCell(PdfExportServer.createCell(bfChinese,
						car.getAssSts() != null ? car.getAssSts() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然担保人车辆设备end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return carTable;
	}

	// 其他财产
	private PdfPTable getGuarOthInfoTable(List<PrjCstAssMbInfoVO> othList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户其他财产start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable othTable = new PdfPTable(10);
		othTable.setWidthPercentage(100f);
		othTable.addCell(PdfExportServer.createCell(bfChinese, "其他财产",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignCenter, 10));
		if (CollectionUtils.isNotEmpty(othList)) {
			othTable.addCell(PdfExportServer.createCell(bfChinese, "资产名称",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "资产类型",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "购买时间",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "现估计（万元）",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "财产状况",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			othTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			// 数据行
			for (int i = 0; i < othList.size(); i++) {
				PrjCstAssMbInfoVO oth = othList.get(i);
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getAssNm() != null ? oth.getAssNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getOthAssTyp() != null ? oth.getOthAssTyp() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(
						bfChinese,
						oth.getPurchDt() != null ? DateUtils
								.formatDateToString(oth.getPurchDt(),
										DateUtils.YYYY_MM_DD) : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(
						bfChinese,
						oth.getValue() != null ? oth.getValue().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getAssSts() != null ? oth.getAssSts() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				othTable.addCell(PdfExportServer.createCell(bfChinese,
						oth.getAssRlCdNm() != null ? oth.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,客户其他财产end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return othTable;
	}

	private PdfPTable getGuarNpAbiInfoTable(PrjCstRepayAbiVO abi,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然人担保人还款能力start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable abiTable = new PdfPTable(10);
		abiTable.setWidthPercentage(100f);
		abiTable.addCell(PdfExportServer.createCell(bfChinese, "还款能力说明",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignLift, 10));
		if (null != abi) {
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"与融资租赁业务申请人关系说明", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getApyRelDesc() != null ? abi.getApyRelDesc() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter, 8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "担保能力说明",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getGuarAbiDesc() != null ? abi.getGuarAbiDesc() : "0",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter, 8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "担保人我司信用记录",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getApyCrdtCdNm() != null ? abi.getApyCrdtCdNm() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "担保人公共信用记录",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"是否有犯罪记录或诉讼案件", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 3));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getIsCrimRecdNm() != null ? abi.getIsCrimRecdNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"是否曾经被金融机构执行资产名称", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 3));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getIsFinaInstAssNm() != null ? abi.getIsFinaInstAssNm()
					: "", fontDateDefault, paddingDefault, borderEnd1,
					alignCenter, 1));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然人担保人还款能力end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return abiTable;
	}

	private PdfPTable getGuarNpPrjCstEmpIntRecTable(
			List<PrjCstEmpIntvRecVO> prjCstEmpIntRecList, String cstTypCd,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然担保人访谈记录start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable recTable = new PdfPTable(10);
		recTable.setWidthPercentage(100f);
		recTable.addCell(PdfExportServer.createCell(bfChinese,
				"邻居/同业人员评价（需体现申请人家庭是否和睦）", new int[] { 10, Font.BOLD },
				paddingDefault, borderEnd1, alignLift, 10));
		if (CollectionUtils.isNotEmpty(prjCstEmpIntRecList)) {
			recTable.addCell(PdfExportServer.createCell(bfChinese, "姓名",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			recTable.addCell(PdfExportServer.createCell(bfChinese, "联系方式",
					fontDefault, paddingDefault, borderEnd1, alignCenter, 2));
			recTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			recTable.addCell(PdfExportServer.createCell(bfChinese, "访谈记录",
					fontDefault, paddingDefault, borderRight, alignCenter, 6));
			// 数据行
			for (int i = 0; i < prjCstEmpIntRecList.size(); i++) {
				PrjCstEmpIntvRecVO rec = prjCstEmpIntRecList.get(i);
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getNm() != null ? rec.getNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getTel() != null ? rec.getTel() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getAssRlCdNm() != null ? rec.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				recTable.addCell(PdfExportServer.createCell(bfChinese,
						rec.getCommRec() != null ? rec.getCommRec() : "",
						fontDateDefault, paddingDefault, borderRight,
						alignCenter, 6));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,自然担保人访谈记录end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return recTable;
	}

	private PdfPTable getGuarInvestRptRecTable(PrjCstInvestRptVO rpt,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保人承诺及签字start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		int[] suggFontDefault = { -1, -1 };
		// 定义默认边距 顺序是：上下左右
		float[] suggPaddingDefault = { 3f, 3f, 2f, 2f };
		// 定义默认位置 水平，垂直
		int[] suggAlignDefault = { -1, -1 };// 靠左
		int[] suggAlignCenter = { PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_CENTER };// 居中
		int[] suggAlignRight = { PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_CENTER };// 靠右
		int[] suggAlignLift = { PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_CENTER };// 靠左
		PdfPTable investRptTable = new PdfPTable(1);
		if (null != rpt) {
			investRptTable.setWidthPercentage(100f);
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					"调查人员意见及承诺（调查人员对内容和资料的真实性、准确性、完整性及由此所作判断的合理性负责）",
					suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignLift, -1));
			String suggStr = "意见: " + rpt.getSugg() != null ? rpt.getSugg()
					: "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					suggStr, suggFontDefault, paddingDefault, borderEnd1,
					suggAlignLift, -1));

			investRptTable
					.addCell(PdfExportServer
							.createCell(
									bfChinese,
									"承诺: "
											+ "本人承诺担保人信息已现场核实，并对担保人做了尽职调查。现场监督了担保人在连带责任担保合同及相关法律文件上的签字用印 ，对其真实性进行了核实。向公司提供的担保人相关权证资料及法律文件等资料和手续真实有效。若由于上述法律文件及资料真实性原因 导致公司权益受到侵害，我个人愿意承担一切责任。 ",
									suggFontDefault, suggPaddingDefault,
									borderEnd1, suggAlignLift, 2));
			String rptTypStr = "报告类型: " + rpt.getCstRptTypCdNm() != null ? rpt
					.getCstRptTypCdNm() : "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					rptTypStr, suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignRight, -1));
			String signStr = "调查人员签字： " + rpt.getInvestor() != null ? rpt
					.getInvestor() : "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					signStr, suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignRight, -1));
			String dateStr = "日期： " + rpt.getRptDt() != null ? DateUtils
					.formatDateToString(rpt.getRptDt(), DateUtils.YYYY_MM_DD)
					: "";
			investRptTable.addCell(PdfExportServer.createCell(bfChinese,
					dateStr, suggFontDefault, suggPaddingDefault, borderEnd1,
					suggAlignRight, -1));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保人承诺及签字end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return investRptTable;
	}

	private PdfPTable getGuarCorpBscCstTable(CstBscInfoDTO cstInfo,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,法人担保人信息start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable corpBscTable = new PdfPTable(10);
		corpBscTable.setWidthPercentage(100f);
		if (null != cstInfo) {
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "担保人信息",
					new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
					alignLift, 10));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "企业名称",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
					cstInfo.getCstNm() != null ? cstInfo.getCstNm() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					3));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "注册资本金",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getRegCapAmt() != null ? cstInfo
					.getCstCorpBscInfoDTO().getRegCapAmt().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			/*
			 * corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "员工数量"
			 * , fontDateDefault, paddingDefault, borderStart,alignCenter, -1))
			 * ; corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
			 * cstInfo.getCstCorpBscInfoDTO().getEmpQtyCd()!=null?cstInfo.
			 * getCstCorpBscInfoDTO().getEmpQtyCd():"0", fontDateDefault,
			 * paddingDefault, borderStart,alignCenter, -1)) ;
			 */
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "企业性质",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			corpBscTable.addCell(PdfExportServer
					.createCell(bfChinese, cstInfo.getCstCorpBscInfoDTO()
							.getCorpTypCdNm() != null ? cstInfo
							.getCstCorpBscInfoDTO().getCorpTypCdNm() : "",
							fontDateDefault, paddingDefault, borderEnd1,
							alignCenter, 2));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
					"办公用房使用权面积", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getOfficeArea() != null ? cstInfo
					.getCstCorpBscInfoDTO().getOfficeArea().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "房产属性",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getPrpAttr() != null ? cstInfo
					.getCstCorpBscInfoDTO().getPrpAttr() : "", fontDateDefault,
					paddingDefault, borderStart, alignCenter, -1));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "价值",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getPrpVal() != null ? cstInfo
					.getCstCorpBscInfoDTO().getPrpVal() : "", fontDateDefault,
					paddingDefault, borderStart, alignCenter, -1));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "办公电话",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getOfficeTel() != null ? cstInfo
					.getCstCorpBscInfoDTO().getOfficeTel() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter,
					-1));

			/*
			 * corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "办公地址"
			 * , fontDateDefault, paddingDefault, borderStart,alignCenter, 2)) ;
			 * corpBscTable.addCell(PdfExportServer.createCell(bfChinese,
			 * cstInfo.getCstCorpBscInfoDTO().getOfficeAddr()!=null?cstInfo.
			 * getCstCorpBscInfoDTO().getOfficeAddr():"" , fontDateDefault,
			 * paddingDefault, borderEnd1,alignCenter, 8)) ;
			 */
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "办公传真",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getCorpTax() != null ? cstInfo
					.getCstCorpBscInfoDTO().getCorpTax() : "", fontDateDefault,
					paddingDefault, borderRight, alignLift, 3));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "贷款卡号",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getLoanCardNo() != null ? cstInfo
					.getCstCorpBscInfoDTO().getLoanCardNo().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					3));

			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, "贷款卡密码",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			corpBscTable.addCell(PdfExportServer.createCell(bfChinese, cstInfo
					.getCstCorpBscInfoDTO().getLoanCardPwd() != null ? cstInfo
					.getCstCorpBscInfoDTO().getLoanCardPwd() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter,
					-1));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,法人担保人信息end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return corpBscTable;
	}

	private PdfPTable getGuarCorpAbiInfoTable(PrjCstRepayAbiVO abi,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保还款能力start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable abiTable = new PdfPTable(10);
		abiTable.setWidthPercentage(100f);
		abiTable.addCell(PdfExportServer.createCell(bfChinese,
				"担保企业还款能力调查（财务数据以客户提报资料中最新报表为依据）", new int[] { 10, Font.BOLD },
				paddingDefault, borderEnd1, alignLift, 10));
		if (null != abi) {
			abiTable.addCell(PdfExportServer.createCell(bfChinese, "自有车辆数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getOwnCarNum() != null ? abi.getOwnCarNum().toString()
					: "0", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "管理车辆数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getMgrCarNum() != null ? abi.getMgrCarNum().toString()
					: "0", fontDateDefault, paddingDefault, borderStart,
					alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "客户数量",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getCstNum() != null ? abi.getCstNum().toString() : "0",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "从业年限",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getYear() != null ? abi.getYear().toString() : "0",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "资产规模",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getAssScl() != null ? abi.getAssScl().toString() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "房产土地情况",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getHsePptLandSts() != null ? abi.getHsePptLandSts() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "负债",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getDebt() != null ? abi.getDebt().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "净资产",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getNetAss() != null ? abi.getNetAss().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "流动资产",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getLiqAss() != null ? abi.getLiqAss().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "固定资产",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getFixAss() != null ? abi.getFixAss().toString() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					-1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "资产负债率(%)",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getAssDebtRate() != null ? abi.getAssDebtRate().toString()
					: "", fontDateDefault, paddingDefault, borderEnd1,
					alignCenter, -1));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "主营业务收入",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getMainBusiIncm() != null ? abi.getMainBusiIncm()
					.toString() : "", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "净利润",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					-1));
			abiTable.addCell(PdfExportServer.createCell(
					bfChinese,
					abi.getNetPrft() != null ? abi.getNetPrft().toString() : "",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese, "上年利润",
					fontDateDefault, paddingDefault, borderStart, alignCenter,
					2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getLstYearPrft() != null ? abi.getLstYearPrft().toString()
					: "", fontDateDefault, paddingDefault, borderEnd1,
					alignCenter, 2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"对外抵押担保情况说明", fontDateDefault, paddingDefault, borderStart,
					alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getExtMbDesc() != null ? abi.getExtMbDesc() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter, 8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"与融资租赁业务申请人关系说明:", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getApyRelDesc() != null ? abi.getApyRelDesc() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter, 8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"与融资租赁业务申请人关系说明:", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getApyRelDesc() != null ? abi.getApyRelDesc() : "",
					fontDateDefault, paddingDefault, borderEnd1, alignCenter, 8));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"担保企业公共信用记录:", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"是否有犯罪记录或诉讼案件: ", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getIsCrimRecdNm() != null ? abi.getIsCrimRecdNm() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"是否有犯罪记录或诉讼案件: ", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese, abi
					.getIsFinaInstAssNm() != null ? abi.getIsFinaInstAssNm()
					: "", fontDateDefault, paddingDefault, borderEnd1,
					alignCenter, 2));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"担保企业我司信用记录:", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getApyCrdtCd() != null ? abi.getApyCrdtCd() : "",
					fontDateDefault, paddingDefault, borderRight, alignCenter,
					3));

			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					"法人代表我司信用记录:", fontDateDefault, paddingDefault,
					borderStart, alignCenter, 2));
			abiTable.addCell(PdfExportServer.createCell(bfChinese,
					abi.getCorpReprCrdtCd() != null ? abi.getCorpReprCrdtCd()
							: "", fontDateDefault, paddingDefault, borderEnd1,
					alignCenter, 3));

		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保还款能力end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return abiTable;
	}

	private PdfPTable getGuarHouseInfoTable(List<PrjCstAssMbInfoVO> houseList,
			BaseFont bfChinese, float[] borderStart, float[] borderRight,
			float[] borderEnd1, float[] paddingDefault, int[] fontDateDefault,
			int[] alignDefault, int[] alignCenter, int[] alignRight,
			int[] alignLift, int[] fontDefault) {
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保人住房财产start").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		PdfPTable houseTable = new PdfPTable(10);
		houseTable.setWidthPercentage(100f);
		houseTable.addCell(PdfExportServer.createCell(bfChinese, "住房财产",
				new int[] { 10, Font.BOLD }, paddingDefault, borderEnd1,
				alignCenter, 10));
		if (CollectionUtils.isNotEmpty(houseList)) {
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "面积（平米）",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "现估计（万元）",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "房屋登记号",
					fontDefault, paddingDefault, borderStart, alignCenter, 2));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "所有权人",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "与申请人关系",
					fontDefault, paddingDefault, borderStart, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "抵押状态",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "房屋地址",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));
			houseTable.addCell(PdfExportServer.createCell(bfChinese, "权属性质",
					fontDefault, paddingDefault, borderEnd1, alignCenter, -1));

			// 数据行
			for (int i = 0; i < houseList.size(); i++) {
				PrjCstAssMbInfoVO house = houseList.get(i);
				houseTable.addCell(PdfExportServer.createCell(bfChinese, house
						.getArea() != null ? house.getArea().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				houseTable.addCell(PdfExportServer.createCell(bfChinese, house
						.getValue() != null ? house.getValue().toString() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getAssNo() != null ? house.getAssNo() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, 2));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getAssOwner() != null ? house.getAssOwner() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese, house
						.getAssRlCdNm() != null ? house.getAssRlCdNm() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getmStsCdNm() != null ? house.getmStsCdNm() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getAddr() != null ? house.getAddr() : "",
						fontDateDefault, paddingDefault, borderStart,
						alignCenter, -1));
				houseTable.addCell(PdfExportServer.createCell(bfChinese,
						house.getNatureCd() != null ? house.getNatureCd() : "",
						fontDateDefault, paddingDefault, borderEnd1,
						alignCenter, -1));
			}
		}
		BaseLogUtils.newWebLogger("资信调查报告pdf格式拼接,担保人住房财产end").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return houseTable;
	}

	@Override
	public List<KeyValueVO> getRlCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_PRJ_ASS_RL_CD);
	}

	@Override
	public List<AudReturnVisitVO> getAudReturnVisitByPrjId(Long prjId)
			throws BaseException {
		AudReturnVisitQueryCondition qc = new AudReturnVisitQueryCondition();
		qc.setProjectId(prjId);
		List<AudReturnVisitDTO> DTOList = this.auditApiService
				.searchAudReturnVisitList(qc,
						CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd());
		return AudReturnVisitVOTransform.toVOList(DTOList);
	}

	@Override
	public Long addFileRec(SysUlFilesRecQueryCondition fileQc,
			SysUlFilesRecVO fileRec) throws BaseException {
		
		this.sysUlFilesRecService.removeByCondition(fileQc);
		return this.sysUlFilesRecService.add(fileRec);
		/*return this.projectApiService.addFileRec(fileQc,
				SysUlFilesRecVOTransform.toDTO(fileRec));*/
	}

	public List<KeyValueVO> getCntTypCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_CNT_TYP_CD);
	}

	@Override
	public void addFileRecList(SysUlFilesRecQueryCondition fileQc,
			List<SysUlFilesRecVO> fileList) {
		this.projectModifyApiService.addFileRecList(fileQc,
				SysUlFilesRecVOTransform.toDTOList(fileList));
	}

	@Override
	public List<AudCreditInfoVO> getAudCreditInfoByPrjId(Long prjId)
			throws BaseException {
		AudCreditInfoQueryCondition qc = new AudCreditInfoQueryCondition();
		qc.setProjectId(prjId);
		List<AudCreditInfoDTO> searchAudCreditInfoList = this.auditApiService
				.searchAudCreditInfoList(qc,
						CurrentThreadContext.getCurrentSysCd(),
						CurrentThreadContext.getCurrentOrgCd());
		return AudCreditInfoVOTransform.toVOList(searchAudCreditInfoList);
	}

	@Override
	public List<KeyValueVO> getPrjQuatSplitPctList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_QUAT_SPLIT_CD);
	}

	@Override
	public List<KeyValueVO> getPerPctCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_QUAT_PER_PCT_CD);
	}

	@Override
	public String searchSysCtrlCfgByCtrlCode() throws BaseException {
		
		String orgCd = CurrentThreadContext.getCurrentOrgCd();
		SysCtrlCfgQueryCondition qc = new SysCtrlCfgQueryCondition();
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		if(orgCd.length()>8){
			if(orgCd.substring(0, 8).equals("00000008")){
				qc.setCtrlCode(DictionaryConstant.CTRL_PRJ_PRD_COUNT_ZK);
			}else{
				qc.setCtrlCode(DictionaryConstant.CTRL_PRJ_PRD_COUNT);
			}
		}else{
			qc.setCtrlCode(DictionaryConstant.CTRL_PRJ_PRD_COUNT);
		}
		String ctrValue=this.SysCtrlCfgApiService.searchSysCtrlCfgByCtrlCode(qc);
		return ctrValue;
	}
	
	@Override
	public MessageDTO<String> saveTaskTransfer(String ownerId,String assigneeId,String assigneeName) throws BaseException {
		WorkflowClient.setBasePath(PropertiesCacheUtils.getProperty(FlowConstant.FLOW_FLOW_PROPERTIES_FLOW_BASE_URL));
		MessageDTO<String> msgDTO = WorkflowClient.transferTask(ownerId,assigneeId,assigneeName);
		return msgDTO;
	}

	@Override
	public List<KeyValueVO> getSplBackPctList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE_SPL_BACK_CD);
	}

	@Override
	public List<KeyValueVO> getPrjConsSplitPctList() throws BaseException {
		return  this.getKeyValueList(DictionaryConstant.CODE_CAR_SPL_BACK_SPL);
	}
	/**
	 * 项目列表增加逾期信息
	 * @param listVO
	 * @return
	 * @throws BaseException
	 */
	@Override
	public List<PrjBscInfoVO> putOvdDataToPrjBscInfo(List<PrjBscInfoVO> listVO)throws BaseException{
		List<Long> cstIds = new ArrayList<Long>();
		for(PrjBscInfoVO vo : listVO){
			if(StringUtils.isNotEmpty(vo.getCstId())){
				cstIds.add(vo.getCstId());
			}
		}
		if(CollectionUtils.isNotEmpty(cstIds)){
			Map<Long,Long> ovdAmtMap = new HashMap<Long,Long>();
			Map<Long,Integer> ovdDaysMap = new HashMap<Long,Integer>();
			CapFundSummaryQueryCondition condition = new CapFundSummaryQueryCondition();
			condition.setCstIds(cstIds);
			List<CapFundSummaryVO> capVoList =this.capFundSummaryService.searchList(condition);
			for(CapFundSummaryVO capVO : capVoList){
				if(StringUtils.isNotEmpty(capVO.getOvdAmt())){
					ovdAmtMap.put(capVO.getCstId(), capVO.getOvdAmt());
				}
				if(StringUtils.isNotEmpty(capVO.getOvdDays())){
					ovdDaysMap.put(capVO.getCstId(), capVO.getOvdDays());
				}
			}
			for(PrjBscInfoVO vo : listVO){
				if(ovdAmtMap.containsKey(vo.getCstId())){
					vo.setOvdAmt(ovdAmtMap.get(vo.getCstId()));;
				}
				if(ovdDaysMap.containsKey(vo.getCstId())){
					vo.setOvdDays(ovdDaysMap.get(vo.getCstId()));
				}
			}
		}
		
		
		return listVO;
	} 
	@Override
	public PrjPopuInfoDTO getPrjPopuInfo(PrjBscInfoQueryCondition qc)throws BaseException{
		return this.projectApiService.getPrjPopuInfoByPrjQc(qc);
	}

	@Override
	public List<PrjBscInfoVO> searchPrjBscInfoList(PrjBscInfoQueryCondition qc)
			throws BaseException {
		List<PrjBscInfoVO> voList = PrjBscInfoVOTransform.toVOList(projectApiService.searchPrjBscInfoList(qc));
		return voList;
	}
	
	@Override
	public PrjCheckResultDTO checkCreditRule(String prjId) throws BaseException {
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空");
		}
		PrjBscInfoVO vo = this.selectById(Long.valueOf(prjId));
		if (vo == null) {
			BaseLogUtils.newWebLogger("查询项目信息不存在").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
					.setKeys("prjId",prjId)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "查询项目数据不存在");
		}
		return this.projectApiService.checkCreditRule(PrjBscInfoVOTransform.toDTO(vo));
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public Boolean searchRcCstBscInfoByPrjId(String prjId) throws BaseException {
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空");
		}
		PrjBscInfoVO vo = this.selectById(Long.valueOf(prjId));
		if (vo == null) {
			BaseLogUtils.newWebLogger("查询项目信息不存在").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
					.setKeys("prjId",prjId)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "查询项目数据不存在");
		}
		//校验客户经理是否被限制
		PrjFlowAuthCtrlQC strlQc = new PrjFlowAuthCtrlQC();
		strlQc.setIsValid(1);
		strlQc.setPassiveCtrlId(CurrentThreadContext.getCurrentUserId());
		strlQc.setFlowStartTm(DateUtils.formatDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
		strlQc.setCtrlPrjTypCd(vo.getPrjTypCd());
		strlQc.setCtrlContent(PrjFlowAuthCtrlConstant.CTRL_CONTENT_1);
		BaseLogUtils.newLogger("isPrjFlowAuthCtrl.查询项目流程权限控制.入参qc=" + com.alibaba.fastjson.JSONObject.toJSONString(strlQc)).info();
		List<PrjFlowAuthCtrlDTO> prjFlowAuthCtrlDTOS = prjFlowAuthCtrlService.searchList(strlQc);
		BaseLogUtils.newLogger("isPrjFlowAuthCtrl.查询项目流程权限控制.result=" + prjFlowAuthCtrlDTOS.size()).info();
		if (CollectionUtils.isNotEmpty(prjFlowAuthCtrlDTOS) && prjFlowAuthCtrlDTOS.size() > 0) {
			for (PrjFlowAuthCtrlDTO prjFlowAuthCtrlDTO : prjFlowAuthCtrlDTOS) {
				if (StringUtils.isNotEmpty(CurrentThreadContext.getCurrentOrgCd()) && CurrentThreadContext.getCurrentOrgCd().startsWith(prjFlowAuthCtrlDTO.getPassiveCtrlOrgCd())) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "由于权限控制，无法发起立项流程！");
				}
			}
		}
		/*
		Boolean flagZYFL = true;initList.do
		Boolean zxFlagZYFL = true;
		if(PrjBscInfoConstant.PRJ_INS_CODE_ZYFL.equals(vo.getInsCode())){
			BaseLogUtils.info(logger, "searchRcCstBscInfoByPrjId", "浙银金租开户校验经销商收款账号是否一致和四要素鉴权==" + prjId, CurrentThreadContext.getCurrentUserName());
			//浙银金租
			//flagZYFL = projectApiService.checkSplAndUser(PrjBscInfoVOTransform.toDTO(vo),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd());
			PrjPrdBscInfoQueryCondition ppbiQCondition = new PrjPrdBscInfoQueryCondition();
			ppbiQCondition.setPrjId(vo.getId());
			List<PrjPrdBscInfoVO> prjPrdList = prjPrdBscInfoService.searchList(ppbiQCondition);
			BaseLogUtils.info(logger, "searchRcCstBscInfoByPrjId", "查询项目产品数量==" + prjId+"产品数量"+prjPrdList.size(), CurrentThreadContext.getCurrentUserName());
			SplBankVO splBankEntity = splBankService.selectById(prjPrdList.get(0).getSplAccNoId());
			for (int i = 0; i <prjPrdList.size(); i++){
				BaseLogUtils.info(logger, "searchRcCstBscInfoByPrjId", "供应商账号id==" + prjId, CurrentThreadContext.getCurrentUserName());
				SplBankVO splBankVO = splBankService.selectById(prjPrdList.get(i).getSplAccNoId());
				splBankVO.getAccNo();
				if(splBankVO.getAccNo().equals(splBankEntity.getAccNo())){
					BaseLogUtils.info(logger, "searchRcCstBscInfoByPrjId", "供应商账号一致==" + prjId, CurrentThreadContext.getCurrentUserName());
				}else{
					BaseLogUtils.info(logger, "searchRcCstBscInfoByPrjId", "供应商账号不一致==" + prjPrdList.get(i).getSplAccNoId(), CurrentThreadContext.getCurrentUserName());
					flagZYFL = false;
				}
			}
			PrjCstAccInfoQueryCondition passCstUser = new PrjCstAccInfoQueryCondition();
			passCstUser.setPrjId(Long.valueOf(prjId));
			passCstUser.setIsDel(BaseConstant.IS_YESNO_NO);
			List<PrjCstAccInfoDTO> listCstAcc = prjCstAccInfoApiService.searchPrjCstAccInfoList(passCstUser);
			DataResultDTO resultDTO = this.prjCstAccInfoApiService.validePrjCstAccInfo(passCstUser);
			BaseLogUtils.info(logger,"searchRcCstBscInfoByPrjId","浙银金租检验客户信息返回=="+prjId+"==="+ JSON.toJSONString(passCstUser)+",结果="+resultDTO.getCode(),CurrentThreadContext.getCurrentUserName());
			if (listCstAcc.size()> 0 && "1".equals(listCstAcc.get(0).getChkRstCd())) {
				BaseLogUtils.info(logger,"validePrjCstAccInfo","检验客户信息返回通过=="+ JSON.toJSONString(resultDTO)+",结果="+resultDTO.getCode(),CurrentThreadContext.getCurrentUserName());
			} else {
				BaseLogUtils.info(logger,"validePrjCstAccInfo","检验客户信息失败=="+ JSON.toJSONString(resultDTO),CurrentThreadContext.getCurrentUserName());
				flagZYFL = false;
			}
		}
		if(!flagZYFL){
			BaseLogUtils.info(logger, "searchRcCstBscInfoByPrjId", "供应商账号不一致或四要素信息未通过:["+prjId+"]");
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "供应商账号不一致或四要素信息未通过！");
		}
		*/
		PrjPrdDtlQueryCondition qc = new PrjPrdDtlQueryCondition();
		qc.setPrjId(Long.parseLong(prjId));
		qc.setIsDel(0);
		List<PrjPrdDtlDTO> prjPrdDtlDTOS = this.projectApiService.selectPrjPrdDtlList(qc);
		boolean vinCheckResult = this.prjPrdDtlService.checkValidVinSts(prjPrdDtlDTOS, true);
		if(!vinCheckResult){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "VIN验证错误，请修改VIN码！");
		}
		PrjPrdBscInfoQueryCondition prjPrdBscInfoQueryCondition = new PrjPrdBscInfoQueryCondition();
		prjPrdBscInfoQueryCondition.setPrjId(Long.parseLong(prjId));
		prjPrdBscInfoQueryCondition.setIsDel(0);
		List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = this.prjPrdBscInfoService.searchList(prjPrdBscInfoQueryCondition);
		if(CollectionUtils.isEmpty(prjPrdBscInfoVOS)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "项目产品为空");
		}
		Long prjSplId = prjPrdBscInfoVOS.get(0).getSplId();
		Long lnkCompId = prjPrdDtlDTOS.get(0).getLnkCompId();
		Boolean flag = false;
		PrjCheckResultDTO resultDto = this.projectApiService.checkCreditRule(PrjBscInfoVOTransform.toDTO(vo));
		if (resultDto != null) {
			if(StringUtils.isNotEmpty(resultDto.getIsChkRcCstPrj()) && resultDto.getIsChkRcCstPrj() == 1){
				Map<String, Object> rcCstBscInfoMap = resultDto.getRcCstBscInfoMap();
				if(CollectionUtils.isMapNotEmpty(rcCstBscInfoMap)){
					List<RcCstBscInfoDTO> listDto = (List<RcCstBscInfoDTO>) rcCstBscInfoMap.get("rcCstBscInfoList");
					if(CollectionUtils.isNotEmpty(listDto)){
						for (RcCstBscInfoDTO rcCstBscInfoDTO : listDto) {
							//车抵贷特殊处理（临时）
							String prjTypCd = vo.getPrjTypCd();
							String buOrgCd = vo.getBuOrgCd();
							if (StringUtils.isNotEmpty(prjTypCd) && (prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)
									||prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD)
									||prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
								if(rcCstBscInfoDTO.getRskLvlCd().equals("3") || vo.getRcCstBscInfoId() == null){
									flag = false;
									break;
								}else{
									flag = true;
								}
							}else if(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(buOrgCd)
									&& (PrjBscInfoConstant.PRJ_TYP_CD_CTYW.equals(prjTypCd)
									|| PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjTypCd))){
								Long splId = rcCstBscInfoDTO.getSplId();
								if(StringUtils.isNotEmpty(splId) && splId.equals(prjSplId)){
									List<RcCstChannelInfoDTO> rcCstChannelInfoDTOList = rcCstBscInfoDTO.getRcCstChannelInfoDTOList();
									if(StringUtils.isNotEmpty(lnkCompId) && CollectionUtils.isNotEmpty(rcCstChannelInfoDTOList)){
										Long rcCstBscInfoId = null;
										for (RcCstChannelInfoDTO rcCstChannelInfoDTO : rcCstChannelInfoDTOList) {
											if(lnkCompId.equals(rcCstChannelInfoDTO.getChannelId())){
												rcCstBscInfoId = rcCstChannelInfoDTO.getRcCstBscInfoId();
												break;
											}
										}
										if(rcCstBscInfoId != null){
											if(!rcCstBscInfoDTO.getRskLvlCd().equals("3")){
												if(rcCstBscInfoId.equals(vo.getRcCstBscInfoId())){
													flag = true;
												}
											}
										}else {
											if(!rcCstBscInfoDTO.getRskLvlCd().equals("3")){
												if(rcCstBscInfoDTO.getId().equals(vo.getRcCstBscInfoId())){
													flag = true;
												}
											}
										}
									}else{
										if(!rcCstBscInfoDTO.getRskLvlCd().equals("3")){
											if(rcCstBscInfoDTO.getId().equals(vo.getRcCstBscInfoId())){
												flag = true;
											}
										}
									}
								}
							}else{
								if(!rcCstBscInfoDTO.getRskLvlCd().equals("3")){
									if(rcCstBscInfoDTO.getId().equals(vo.getRcCstBscInfoId())){
										flag = true;
									}
								}
							}
						}
					}
				}
				if(!flag){
					BaseLogUtils.newWebLogger("请核查供应商信息，请求参数prjId").setLogOperType(LogOperEnum.REQ)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
							.setKeys("prjId",prjId)
							.setWarning(false)
							.warn(LogExceptionEnum.COMMON_CODE_0002);
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "请核查供应商信息！");
				}
			}
		}
		if(vo.getInsCode()!=null && (PrjBscInfoConstant.PRJ_INS_CODE_ZBBANK.equals(vo.getInsCode()) || PrjBscInfoConstant.PRJ_INS_CODE_XBFL.equals(vo.getInsCode()))){ //  众邦、兴邦  发起流程校验四要素及银行卡类型
//			PrjCstAccInfoVO prjCstAccInfoVO = this.prjCstAccInfoService.selectByPrjId(Long.parseLong(prjId));
            PrjCstAccInfoQueryCondition condition = new PrjCstAccInfoQueryCondition();
            PrjCstAccInfoQueryCondition prjCstAccInfo = new PrjCstAccInfoQueryCondition();
            prjCstAccInfo.setPrjId(Long.parseLong(prjId));
            prjCstAccInfo.setIsDel(BaseConstant.IS_YESNO_NO);
            prjCstAccInfo.setInsCode(vo.getInsCode());
            List<PrjCstAccInfoVO> prjCstAccInfoVOS = this.prjCstAccInfoService.searchList(prjCstAccInfo);
            if (CollectionUtils.isNotEmpty(prjCstAccInfoVOS)) {
                PrjCstAccInfoVO prjCstAccInfoVO = prjCstAccInfoVOS.get(0);
				condition.setId(prjCstAccInfoVO.getId());
				condition.setCertNo(prjCstAccInfoVO.getCertNo());
				condition.setCstId(prjCstAccInfoVO.getCstId());
				condition.setCstNm(prjCstAccInfoVO.getCstNm());
				condition.setCertNo(prjCstAccInfoVO.getCertNo());
				condition.setCertTypCd(prjCstAccInfoVO.getCertTypCd());
				condition.setAccNo(prjCstAccInfoVO.getAccNo());
				condition.setBkCd(prjCstAccInfoVO.getBkCd());
				condition.setBkNm(prjCstAccInfoVO.getBkNm());
				condition.setBkNo(prjCstAccInfoVO.getBkNo());
				condition.setMp(prjCstAccInfoVO.getMp());
				condition.setAccNm(prjCstAccInfoVO.getAccNm());
			}
			condition.setPrjId(Long.parseLong(prjId));
            condition.setInsCode(vo.getInsCode());
			DataResultDTO resultDTO = this.prjCstAccInfoApiService.verificationPrjAccInfo(condition);

			if(null != resultDTO && null != resultDTO.getData()){
				@SuppressWarnings("unchecked")
				Map<String, String> ckResMap = (Map<String, String>) resultDTO.getData();
				String chkRstCd = ckResMap.get("chkRstCd");
				// String rstDesc = ckResMap.get("rstDesc");
				String bankCardType = ckResMap.get("bankCardType");
				if(chkRstCd.equals("1")){  // 四要素信息校验通过
					if (!"0".equals(bankCardType)){  //
						throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "不支持此类银行卡，请更换为借记卡");
					}
				}else if(chkRstCd.equals("0") || chkRstCd.equals("2")){
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "四要素信息校验未通过");
				}
			} else if (resultDTO!=null){
				if(resultDTO.getSuccess()!=BaseConstant.IS_YESNO_YES){
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, resultDTO.getInfo());
				}
			} else {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "客户四要素信息校验异常");
			}
		}

		return true;
	}

	@Override
	public void checkPreAudInfo(Long prjId, Long cstId) throws BaseException{
		BaseLogUtils.newLogger("预审校验.prjId:{}", prjId).info();
		PrjBscInfoVO vo = this.selectById(Long.valueOf(prjId));
		if (null == vo){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "查询项目数据不存在");
		}
		//校验客户经理是否被限制
		PrjFlowAuthCtrlQC strlQc = new PrjFlowAuthCtrlQC();
		strlQc.setIsValid(1);
		strlQc.setPassiveCtrlId(CurrentThreadContext.getCurrentUserId());
		strlQc.setFlowStartTm(DateUtils.formatDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
		strlQc.setCtrlPrjTypCd(vo.getPrjTypCd());
		strlQc.setCtrlContent(PrjFlowAuthCtrlConstant.CTRL_CONTENT_1);
		BaseLogUtils.newLogger("isPrjFlowAuthCtrl.查询项目流程权限控制.入参qc=" + com.alibaba.fastjson.JSONObject.toJSONString(strlQc)).info();
		List<PrjFlowAuthCtrlDTO> prjFlowAuthCtrlDTOS = prjFlowAuthCtrlService.searchList(strlQc);
		BaseLogUtils.newLogger("isPrjFlowAuthCtrl.查询项目流程权限控制.result=" + prjFlowAuthCtrlDTOS.size()).info();
		if (CollectionUtils.isNotEmpty(prjFlowAuthCtrlDTOS) && prjFlowAuthCtrlDTOS.size() > 0) {
			for (PrjFlowAuthCtrlDTO prjFlowAuthCtrlDTO : prjFlowAuthCtrlDTOS) {
				if (StringUtils.isNotEmpty(CurrentThreadContext.getCurrentOrgCd()) && CurrentThreadContext.getCurrentOrgCd().startsWith(prjFlowAuthCtrlDTO.getPassiveCtrlOrgCd())) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "由于权限控制，无法发起立项流程！");
				}
			}
		}
		Boolean flag = false;
		PrjCheckResultDTO resultDto = this.projectApiService.checkCreditRule(PrjBscInfoVOTransform.toDTO(vo));
		BaseLogUtils.newLogger("预审校验.result=" + com.alibaba.fastjson.JSONObject.toJSONString(resultDto)).info();

		if (resultDto != null) {
			if(StringUtils.isNotEmpty(resultDto.getIsChkRcCstPrj()) && resultDto.getIsChkRcCstPrj() == 1){
				Map<String, Object> rcCstBscInfoMap = resultDto.getRcCstBscInfoMap();
				if(CollectionUtils.isMapNotEmpty(rcCstBscInfoMap)){
					List<RcCstBscInfoDTO> listDto = (List<RcCstBscInfoDTO>) rcCstBscInfoMap.get("rcCstBscInfoList");
					if(CollectionUtils.isNotEmpty(listDto)){
						for (RcCstBscInfoDTO rcCstBscInfoDTO : listDto) {
							//车抵贷特殊处理（临时）
							String prjTypCd = vo.getPrjTypCd();
							if (StringUtils.isNotEmpty(prjTypCd) && (prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)
									||prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
								if(rcCstBscInfoDTO.getRskLvlCd().equals("3")){
									flag = false;
									break;
								}else{
									flag = true;
								}
							}
						}
					}
				}
				if(!flag){
					BaseLogUtils.newWebLogger("请核查供应商信息，请求参数prjId:{}" + prjId).info();
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "请核查供应商信息！");
				}
			}
		}
		this.projectApiService.checkPreAudInfo(prjId, cstId);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public PrjCheckResultDTO searchRcCstBscInfoList(String buOrgCd,String prjTypCd,Long cstId,String cstMgrOrgCd,Long prjId,Boolean flag,String insCode) throws BaseException {
		List<RcCstBscInfoDTO> listDto = new ArrayList<>();
		Map<String, Object> rcCstBscInfoMap = new HashMap<>();
		PrjCheckResultDTO resultDto = null;
		Integer isChkFlag = 1;
		Date crtTm = null;
		if(StringUtils.isNotEmpty(prjId) && !flag){
			PrjBscInfoVO dto = this.selectById(prjId);
			if(dto != null){
				resultDto = new PrjCheckResultDTO(PrjCheckResultDTO.IS_1, PrjCheckResultDTO.IS_0);
				crtTm = dto.getCrtTm();
				if(StringUtils.isNotEmpty(dto.getRcCstBscInfoId()) && dto.getIsChkRcCstPrj() == 1){
					List<RcCstBscInfoDTO> list = new ArrayList<>();
					RcCstBscInfoDTO rcDto = this.riskCtrlSearchApiService.getRcCstBscInfoByIdWithDic(dto.getRcCstBscInfoId(), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
					list.add(rcDto);
					rcCstBscInfoMap.put("rcCstBscInfoList", list);//客户信息
					listDto.add(rcDto);
					//配偶征信信息
					if(StringUtils.isNotEmpty(dto.getInsCode()) && dto.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC)){
						if (StringUtils.isNotEmpty(dto.getRlRcCstBscInfoId())){
							RcCstBscInfoDTO rlRcDto = this.riskCtrlSearchApiService.getRcCstBscInfoByIdWithDic(dto.getRlRcCstBscInfoId(), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
							list.clear();
							list.add(rlRcDto);
							rcCstBscInfoMap.put("rlRcCstBscInfoList",list);
							resultDto.setMarStsCdNm("已婚");
							resultDto.setRlNm(rlRcDto.getCstNm());
						}else{
							resultDto.setMarStsCdNm(PrjCstNpBscInfoConstant.CST_NP_MAR_STS_STR_WH);
							resultDto.setRlNm("");
						}
					}
					resultDto.setRcCstBscInfoMap(rcCstBscInfoMap);
				}
			}
		}
		if(CollectionUtils.isEmpty(listDto)) {
			if (crtTm == null) {
				crtTm = new Date();
			}
			PrjBscInfoDTO dto = new PrjBscInfoDTO();
			dto.setBuOrgCd(buOrgCd);
			dto.setCrtTm(crtTm);
			dto.setPrjTypCd(prjTypCd);
			dto.setCstId(cstId);
			dto.setCstMgrOrgCd(cstMgrOrgCd);
			dto.setInsCode(insCode);
			resultDto = this.projectApiService.checkCreditRule(dto);
			if (resultDto != null) {
				if(StringUtils.isNotEmpty(resultDto.getRlResult())){
					if (StringUtils.isNotEmpty(resultDto.getResultCode()) && String.valueOf(BaseConstant.IS_YESNO_YES).equals(resultDto.getResultCode())) {
						isChkFlag = 1;
					} else {
						isChkFlag = 0;
					}
				}
				if(StringUtils.isEmpty(resultDto.getRlNm())){
					resultDto.setRlNm("");
				}
			} else {
				resultDto = new PrjCheckResultDTO(PrjCheckResultDTO.IS_1, PrjCheckResultDTO.IS_0);
			}
		}
		resultDto.setIsChkRcCstPrj(isChkFlag);
		BaseLogUtils.newWebLogger("立项查询征信信息 返回数据："+ JSON.toJSONString(resultDto)).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
				.setWarning(false)
				.info();
		return resultDto;
	}

	@Override
	public PrjBscInfoVO selectMfrPrjBscInfoDetai(Long prjId) throws BaseException {
		return PrjBscInfoVOTransform.toVO(this.projectQueryApiService.selectMfrPrjBscInfoDetai(prjId,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd()));
	}

	@Override
	public Pager searchMfrListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = this.projectQueryApiService.searchMfrListPage(page,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd());
		page.setResultList(PrjBscInfoVOTransform.toVOList((List<PrjBscInfoDTO>) page.getResultList()));
		return page;
	}
	@Override
	public List<KeyValueVO> getPrjPreRntPctList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE__PRJ_PRE_RNT_PCT_CD);
	}

	/**
	 * 查询数据字典
	 * @param groupCd 组代码
	 * @return List<KeyValueVO>
	 */
	public List<KeyValueVO> searchCdList(String groupCd) throws BaseException{
		return this.sysDictionaryApiService.getKvList(groupCd, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
	}

	/**
	 * 修改签约信息
	 * @param vo
	 * @return
	 * @throws BaseException
	 */
	public boolean modifySignInfo(PrjBscInfoVO vo) throws BaseException{
		return this.projectModifyApiService.modifySignInfo(PrjBscInfoVOTransform.toDTO(vo));
	}
	@Override
	public List<KeyValueVO> searchBusinessInsCdList() throws BaseException {
		return this.getKeyValueList(DictionaryConstant.CODE__PRJ_PRD_PAY_PLCY);
	}

	@Override
	public List<KeyValueVO> getLicenseCdList() throws BaseException {
		
		return this.getKeyValueList(DictionaryConstant.CODE__PRJ_PRD_CLS_PLCY);
	}

	@Override
	public Long addPrjPrdBscAndDetailInfo(PrjPrdBscInfoVO prdBscInfoVO, PrjPrdExtVO extDTO) throws BaseException {
		BaseLogUtils.newWebLogger("==获取产品信息=prdBscInfoVO:" + JSON.toJSONString(prdBscInfoVO)).info();
		if (null == prdBscInfoVO) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请填写商品基础信息!");
		}
		// 查询是否有支付表信息
		PrjPrdPaySchMQueryCondition qc = new PrjPrdPaySchMQueryCondition();
		qc.setPrjId(prdBscInfoVO.getPrjId());
        qc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
		List<PrjPrdPaySchMVO> prjQuatList = this.prjPrdPaySchMService
				.searchList(qc);
		if (CollectionUtils.isNotEmpty(prjQuatList)) {
			prdBscInfoVO.setRemoveFlag(String
					.valueOf(BaseConstant.IS_YESNO_YES));
		} else {
			prdBscInfoVO
					.setRemoveFlag(String.valueOf(BaseConstant.IS_YESNO_NO));
		}
        PrjPrdParamConfigVO prdDetail = null;
        PrjBscInfoVO prjBscInfoVO =  this.selectById(prdBscInfoVO.getPrjId());
		BaseLogUtils.newWebLogger("==获项目信息=prjId:" + prdBscInfoVO.getPrjId()).info();
		BaseLogUtils.newWebLogger("==获取车源id=carSourceId:" + prdBscInfoVO.getCarSourceId()).info();
        //查询车源库信息
        if(null!=prdBscInfoVO.getCarSourceId()&&(prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)||prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBscInfoVO.getPrjTypCd()))){
            prdDetail = this.vehicleSrcService.getPrdDetail(prdBscInfoVO.getCarSourceId(),prjBscInfoVO.getPrjTypCd(),prjBscInfoVO.getBuOrgCd());
            prdBscInfoVO.setPrdCd(prdDetail.getPrdCd());
            if(null!=prdDetail.getCarSourceId()){
                prdBscInfoVO.setCarSourceId(prdDetail.getCarSourceId());
            }
            if(StringUtils.isNotBlank(prdDetail.getCarNo())){
                prdBscInfoVO.setCarNo(prdDetail.getCarNo());
            }
          /*  if(StringUtils.isNotBlank(prdDetail.getVehCheckCode())){
                prdBscInfoVO.setVehCheckCode(prdDetail.getVehCheckCode());
            }*/
            if(null!=prdDetail.getReleaseDate()){
                prdBscInfoVO.setReleaseDate(prdDetail.getReleaseDate());
            }
			if(StringUtils.isNotBlank(prdDetail.getBrCdNm())){
				prdBscInfoVO.setBrCd(prdDetail.getBrCdNm());
			}
            if(null!=prdDetail.getVin()){
                PrjPrdDtlVO prjprdDtlVO = new PrjPrdDtlVO();
                prjprdDtlVO.setVin(prdDetail.getVin());
                //校验vin
                    boolean checkRes = vinUtilsApiService.validVinCheckBit(prdDetail.getVin());
                    String checkResult = "0";
                    if(checkRes){
                        checkResult = "1";
                    }
                prjprdDtlVO.setVinValidRes(checkResult);
                prdBscInfoVO.setDtl(prjprdDtlVO);
            }
            if(null!=prdDetail && null!=prdDetail.getMil()){
				PrjPrdExtVO prjPrdExtVO = new PrjPrdExtVO();
				prjPrdExtVO.setTvlMil(Double.valueOf(prdDetail.getMil()));
				prdBscInfoVO.setPrjPrdExtVO(prjPrdExtVO);
			}
        }

        //车源检测信息
        if(prdDetail!=null){
            PrjPrdSourceInfoVO sourceInfoVO = new PrjPrdSourceInfoVO();
            if(StringUtils.isNotBlank(prdDetail.getOwnerNm())){
                sourceInfoVO.setOwnerNm(prdDetail.getOwnerNm());
            }
            if(null!=prdDetail.getSurveyorId()){
                sourceInfoVO.setSurveyorId(prdDetail.getSurveyorId());
            }
            if(StringUtils.isNotBlank(prdDetail.getSurveyorNm())){
                sourceInfoVO.setSurveyorNm(prdDetail.getSurveyorNm());
            }
            if(null!=prdDetail.getDetectionDate()){
                sourceInfoVO.setDetectionDate(prdDetail.getDetectionDate());
            }
            if(null!=prdDetail.getVehVal()){
                sourceInfoVO.setVehValNew(prdDetail.getVehVal());
            }
            if(null!=prdDetail.getParkingLot()){
                sourceInfoVO.setParkingLot(prdDetail.getParkingLot());
            }
            if(null!=prdDetail.getLicDt()){
                sourceInfoVO.setLicDt(prdDetail.getLicDt());
            }
            if(StringUtils.isNotBlank(prdDetail.getLicNo())){
                sourceInfoVO.setLicNo(prdDetail.getLicNo());
            }
            if(null!=prdDetail.getEstPurmaxpricea()){
                sourceInfoVO.setEstPurmaxprice(prdDetail.getEstPurmaxpricea()*100);
            }
            if(null!=prdDetail.getEstPurminpricea()){
                sourceInfoVO.setEstPurminprice(prdDetail.getEstPurminpricea()*100);
            }
            if(null!=prdDetail.getEstRetailmaxprice()){
                sourceInfoVO.setEstRetailmaxprice(prdDetail.getEstRetailmaxprice()*100);
            }
            if(null!=prdDetail.getEstRetailminprice()){
                sourceInfoVO.setEstRetailminprice(prdDetail.getEstRetailminprice()*100);
            }
            if(null!=prdDetail.getPurchasingPrice()){
                sourceInfoVO.setPurchasingPrice(prdDetail.getPurchasingPrice()*100);
            }
            if(null!=prdDetail.getEvaOfPrice()){
                sourceInfoVO.setEvaOfPrice(prdDetail.getEvaOfPrice()*100);
            }
            if(StringUtils.isNotBlank(prdDetail.getClassNm())){
                sourceInfoVO.setClassNm(prdDetail.getClassNm());
            }
            if(null!=prdBscInfoVO.getVehVal()){
                sourceInfoVO.setVehValNew(prdBscInfoVO.getVehVal());
            }
            if(null!=prdDetail.getPrvCode()){
                sourceInfoVO.setProvCd(prdDetail.getPrvCode());
            }
            if(null!=prdDetail.getCityCode()){
                sourceInfoVO.setCityCd(prdDetail.getCityCode());
            }
			if(StringUtils.isNotBlank(prdDetail.getPdfFilePath())){
				sourceInfoVO.setPdfFilePath(prdDetail.getPdfFilePath());
			}
			if(StringUtils.isNotBlank(prdDetail.getAbsLocPath())){
				sourceInfoVO.setAbsLocPath(prdDetail.getAbsLocPath());
			}
            prdBscInfoVO.setPrjPrdSourceInfo(sourceInfoVO);
        }

		Long prdId = this.prjPrdBscInfoService.addPrjPrdBscAndDetailInfo(prdBscInfoVO, extDTO);
		/*
		 * //保存产品基础信息 Long prdId= this.prjPrdBscInfoService.add(prdBscInfoVO);
		 * if(StringUtils.isNotEmpty(prdId)&&null!=prdCarInfoVO){
		 * prdCarInfoVO.setId(prdId); Long carId =
		 * this.prjPrdCarInfoService.add(prdCarInfoVO); }
		 * if(StringUtils.isNotEmpty(prdId)&&null!=prdTkInfoVO){
		 * prdTkInfoVO.setId(prdId); Long tkId =
		 * this.prjPrdTkInfoService.add(prdTkInfoVO); }
		 */
		return prdId;
	}

	@Override
	public void modifyPrjPrdBscAndDetailInfo(PrjPrdBscInfoVO prdBscInfoVO, PrjPrdExtVO extDTO) throws BaseException {
		if (null == prdBscInfoVO) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请填写商品基础信息!");
		}
		// 查询是否有支付表信息
		PrjPrdPaySchMQueryCondition qc = new PrjPrdPaySchMQueryCondition();
		qc.setPrjId(prdBscInfoVO.getPrjId());
        qc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
		List<PrjPrdPaySchMVO> prjQuatList = this.prjPrdPaySchMService
				.searchList(qc);
		PrjPrdBscInfoVO prdbsc = this.prjPrdBscInfoService
				.selectById(prdBscInfoVO.getId());

		if (CollectionUtils.isNotEmpty(prjQuatList)
				&& (prdBscInfoVO.getGuidePc().doubleValue() != (prdbsc
				.getGuidePc().doubleValue()) || prdBscInfoVO
				.getPrdQty() != prdbsc.getPrdQty())) {
			prdBscInfoVO.setRemoveFlag(String
					.valueOf(BaseConstant.IS_YESNO_YES));
		} else {
			prdBscInfoVO
					.setRemoveFlag(String.valueOf(BaseConstant.IS_YESNO_NO));
		}
		// 修改产品基础信息
		/*
		 * this.prjPrdBscInfoService.modify(prdBscInfoVO);
		 * if(null!=prdCarInfoVO){
		 * this.prjPrdCarInfoService.modify(prdCarInfoVO); }
		 * if(null!=prdTkInfoVO){ this.prjPrdTkInfoService.modify(prdTkInfoVO);
		 * }
		 */
		this.prjPrdBscInfoService.modifyPrjPrdBscAndDetailInfo(prdBscInfoVO,extDTO);
	}
	
	@Override
	public List<Map<String, Object>> selectChangeBankCardPrjPaySchInfo(Long prjId,Long cstId, String insCode) throws BaseException  {
		return this.projectApiService.selectChangeBankCardPrjPaySchInfo(prjId,cstId,insCode);
	}
	/*修改项目基础扩展信息
	 * (non-Javadoc)
	 * @see cn.fl.project.service.IPrjBscInfoService#modifyprjBscExtVO(cn.fl.project.vo.PrjBscExtVO)
	 */
	@Override
	public Long savePrjBscExt(PrjBscExtVO entity) throws BaseException {
		if(null == entity){
			BaseLogUtils.newWebLogger("修改对象参数不能为空!").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		}
	  return this.projectApiService.savePrjBscExt(PrjBscExtVOTransform.toDTO(entity));
	}
	/*查询
	 * (non-Javadoc)
	 * @see cn.fl.project.service.IPrjBscInfoService#selectByPrjBscExtId(java.lang.Long)
	 */
	@Override
	public PrjBscExtVO selectByPrjBscExtId(Long prjId) throws BaseException {
		if (StringUtils.isEmpty(prjId))
		    return null;
			// TODO 业务逻辑
		PrjBscExtDTO dto = this.projectApiService.selectByPrjBscExtId(prjId,
					CurrentThreadContext.getCurrentSysCd(),
					CurrentThreadContext.getCurrentOrgCd());
		return PrjBscExtVOTransform.toVO(dto);
	}


	/**
	 * 查询验车信息是否录入车牌号
	 * @param prjId 项目id
	 * @return Long 0-未录入，1-已录入
	 * @throws BaseException
	 */
	@Override
	public Long areOrNoRegistration(Long prjId) throws BaseException {
		if (prjId == null) {
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请求参数不能为空!");
		}
		Long registration = 0L;
		try{
			PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
			prjPrdDtlQc.setPrjId(prjId);
			List<PrjPrdDtlVO> prjPrdDtlList = this.prjprdDtlService.selectList(prjPrdDtlQc);
			if (CollectionUtils.isNotEmpty(prjPrdDtlList)) {
				List<PrjPrdDtlVO> firstElement = prjPrdDtlList.subList(0, 1);
				for (PrjPrdDtlVO prjPrdDtlVO : firstElement) {
					PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlVO.getId());
					if (prjPrdLicInfoVO != null) {
						if (StringUtils.isNotBlank(prjPrdLicInfoVO.getVehNo())) {
							registration = 1L;
						}
					}
				}
			}
		}catch (Exception e){
			BaseLogUtils.newWebLogger("查询验车信息是否录入车牌号异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.error(LogExceptionEnum.COMMON_CODE_0099);
			throw new BaseException("查询验车信息是否录入车牌号异常.");
		}
		return registration;
	}

	/**
	 * 里程数据判断
	 * @param prjId 项目id
	 * @return String 验车方案
	 * @throws BaseException
	 */
	@Override
	public String checkMileage(Long prjId) throws BaseException {
		if (prjId == null) {
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请求参数不能为空!");
		}
		String validationCar = "";
		try{
			PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
			prjPrdDtlQc.setPrjId(prjId);
			List<PrjPrdDtlVO> prjPrdDtlList = this.prjprdDtlService.selectList(prjPrdDtlQc);

			if (CollectionUtils.isNotEmpty(prjPrdDtlList)) {
//			List<PrjPrdDtlVO> firstElement = prjPrdDtlList.subList(0, 1);
				for (PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlList) {
//				PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlVO.getId());
					PrjPrdLicInfoQueryCondition licInfoQueryCondition = new PrjPrdLicInfoQueryCondition();
					licInfoQueryCondition.setDtlId(prjPrdDtlVO.getId());
					licInfoQueryCondition.setVerification("2");// 已验车
					GetPrjPrdLicInfoListRequest getPrjPrdLicInfoListRequest = new GetPrjPrdLicInfoListRequest();
					getPrjPrdLicInfoListRequest.setSysCd(CurrentThreadContext.getCurrentSysCd());
					getPrjPrdLicInfoListRequest.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					cn.fl.preloan.condition.PrjPrdLicInfoQueryCondition prdLicInfoQueryCondition = new cn.fl.preloan.condition.PrjPrdLicInfoQueryCondition();
					BeanUtils.copyProperties(licInfoQueryCondition,prdLicInfoQueryCondition);
					getPrjPrdLicInfoListRequest.setCondition(prdLicInfoQueryCondition);
					Long start = System.currentTimeMillis();
					BaseLogUtils.newWebLogger("贷前服务-查询列表开始调用").setLogOperType(LogOperEnum.REQ)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
							.setWarning(false)
							.setKeys("getPrjPrdLicInfoListRequest", JSON.toJSONString(getPrjPrdLicInfoListRequest))
							.info();
					ResponseData<GetPrjPrdLicInfoListResponseDTO> getPrjPrdLicInfoListResponse = iProprdLicenseService.searchList(getPrjPrdLicInfoListRequest);
					BaseLogUtils.newWebLogger("贷前服务-查询列表开始调用").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
							.setWarning(false)
							.setKeys("result", JSON.toJSONString(getPrjPrdLicInfoListResponse))
							.info();
					List<PrjPrdLicInfoVO> licInfoVOList = new ArrayList<>();
					List<cn.fl.preloan.dto.PrjPrdLicInfoDTO> licInfoDTOS = getPrjPrdLicInfoListResponse.getData().getPrjPrdLicInfoDTOS();
					for (cn.fl.preloan.dto.PrjPrdLicInfoDTO prjPrdLicInfoDTO:licInfoDTOS){
						PrjPrdLicInfoVO prjPrdLicInfoVO = new PrjPrdLicInfoVO();
						BeanUtils.copyProperties(prjPrdLicInfoDTO,prjPrdLicInfoVO);
						licInfoVOList.add(prjPrdLicInfoVO);
					}
					if (licInfoVOList != null && licInfoVOList.size() > 0){
						PrjPrdLicInfoVO prjPrdLicInfoVO = licInfoVOList.get(0);
						if (prjPrdLicInfoVO != null && prjPrdDtlVO.getPrjPrdId() != null) {
							validationCar += this.promptStatements(prjPrdLicInfoVO.getVehNo(),prjPrdDtlVO.getPrjPrdId());
						}
					}
				}
			}
		}catch (Exception e){
			BaseLogUtils.newWebLogger("里程数据判断异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_PRJ_BUILD_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.error(LogExceptionEnum.COMMON_CODE_0099);
			throw new BaseException("里程数据判断异常.");
		}
		return validationCar;
	}

	/**
	 * 生成验车方案
	 * @param vehNo 车牌号
	 * @param prjPrdId 项目产品id
	 * @return String 验车方案
	 */
	private String promptStatements(String vehNo,Long prjPrdId) {
		if (prjPrdId ==null) {
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请求参数不能为空!");
		}
		StringBuffer previewString = new StringBuffer();
		Double totalMileaged = this.getTotalMileage(new Date(),vehNo);
		if (totalMileaged != null) {
			String validationCar = "";
			String noValidationCar = "";
			PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(prjPrdId);
			if (prjPrdBscInfoVO.getPrdTypCd().equals("1")) {
				if (totalMileaged <3000) {
					 validationCar = "不可操作高折扣在线验车方案";
					 noValidationCar = "最高放款金额不超过3万";
				}else if (3000 <= totalMileaged && totalMileaged < 5000) {
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过5万";
				}else if (5000 <= totalMileaged && totalMileaged < 10000){
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过3折/5折";
				}else if (totalMileaged >= 10000){
					validationCar = "可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过3折/5折";
				}
			} if (prjPrdBscInfoVO.getPrdTypCd().equals("3")) {
				if (totalMileaged < 2000) {
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款金额不超过3万";
				}else if (2000 <= totalMileaged && totalMileaged < 3000) {
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过5万";
				}else if (3000 <= totalMileaged && totalMileaged < 6000){
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过3折/5折";
				}else if (totalMileaged >= 6000){
					validationCar = "可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过3折/5折";
				}
			}
			if (! prjPrdBscInfoVO.getPrdTypCd().equals("3") && ! prjPrdBscInfoVO.getPrdTypCd().equals("1")){
				if (totalMileaged < 1000) {
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款金额不超过3万";
				}else if (1000 <= totalMileaged && totalMileaged < 1500) {
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过5万";
				}else if (1500 <= totalMileaged && totalMileaged < 3000){
					validationCar = "不可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过3折/5折";
				}else if (totalMileaged >= 3000){
					validationCar = "可操作高折扣在线验车方案";
					noValidationCar = "最高放款额不超过3折/5折";
				}
			}
			previewString.append("<b>【验车提示】</b>");
			previewString.append("</br>验车方案："+validationCar);
			previewString.append("</br>不验车方案："+noValidationCar);
			previewString.append("</br>查里程的车牌号："+vehNo);

		}else {
			previewString.append("</br>提示：未查到结果，验车方案已信审审核结果为准。");
		}
		return previewString.toString();
	}

	private Double getTotalMileage(Date date, String vehNo) {
		Date dBefore = new Date();//前一个月的时间
		Date dBefores = new Date();//前两个月的时间
		Date dBeforea = new Date();//前三个月的时间

		Calendar calendar = Calendar.getInstance(); //得到日历
	    calendar.setTime(date);//把当前时间赋给日历
	    calendar.add(Calendar.MONTH, -1);  //设置为前1月
	    dBefore = calendar.getTime();//得到前一个月的时间

	    calendar.setTime(dBefore);//把当前时间赋给日历
	    calendar.add(Calendar.MONTH, -1);  //设置为前2月
	    dBefores = calendar.getTime();//得到前两个月的时间

	    calendar.setTime(dBefores);//把当前时间赋给日历
	    calendar.add(Calendar.MONTH, -1);  //设置为前3月
	    dBeforea = calendar.getTime();//得到前三个月的时间

	    SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM"); //设置时间格式
	    String defaultStartDate = sdf.format(dBefore);//格式化前1月的时间
	    String defaultStartDates = sdf.format(dBefores);//格式化前2月的时间
	    String defaultStartDatea = sdf.format(dBeforea);//格式化前3月的时间

	    String mileage = "";
	    Double totalMileage = null;
	    List<String> list = new ArrayList<>();
	    List<Double> totalMileageList = new ArrayList<>();
	    Map<String, Object> param = new HashMap<>();
	    list.add(defaultStartDate); list.add(defaultStartDates); list.add(defaultStartDatea);
	    for (String queryTm : list) {
	    	param.put("plateNo", vehNo);
			param.put("queryTm", queryTm);
			param.put("vco", 2);
			mileage = this.ofeMileageLogApiService.queryOperationData(this.toJsonString(param));
			Map<String, Object> map = this.toObject(mileage, Map.class);
			if (map.get("totalMileage")!=null) {
				String totalMileagea = map.get("totalMileage").toString();
				totalMileageList.add(Double.parseDouble(totalMileagea));
			}else {
				totalMileageList = new ArrayList<>();
				break;
			}
	    }
	    if (CollectionUtils.isNotEmpty(totalMileageList)) {
	    	totalMileage = Collections.min(totalMileageList);//获取最小值
			BaseLogUtils.newWebLogger("获取最小里程数").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
					.setWarning(false)
					.setKeys("totalMileage", totalMileage.toString())
					.info();
	    }
		return totalMileage;
	}

	private static volatile ObjectMapper mapper = new ObjectMapper();

	public static String toJsonString(Object obj) {
		try {
			return mapper.writeValueAsString(obj);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	public static <T> T toObject(String json, Class<T> clazz) {
		if (json == null) return null;
		try {
			return mapper.readValue(json, clazz);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
    @Override
    public List<KeyValueVO> searchVehCheckCdList () {
        String code = DictionaryConstant.VEH_CHECK_CD;
        return this.getKeyValueList(code);
    }

	@Override
	public void modifyPrjPrdCarSourceDetailInfo(PrjPrdBscInfoVO prdBscInfoVO, PrjPrdExtVO extDTO) throws BaseException {
		BaseLogUtils.newWebLogger("==获取产品信息=prjId:" + prdBscInfoVO.getPrjId()+",prdBscInfoVO:"+JSON.toJSONString(prdBscInfoVO)).info();
		if (null == prdBscInfoVO) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "商品基础信息为空!");
		}
		PrjPrdParamConfigVO prdDetail = null;
		PrjPrdBscInfoVO prdbsc = this.prjPrdBscInfoService.selectById(prdBscInfoVO.getId());
		PrjBscInfoVO prjBscInfoVO =  this.selectById(prdBscInfoVO.getPrjId());
		BaseLogUtils.newWebLogger("==获取车源id=carSourceId:" + prdbsc.getCarSourceId()).info();
		//查询车源库信息
		if(null!=prdbsc.getCarSourceId()&&(prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)||prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBscInfoVO.getPrjTypCd()))){
			prdDetail = this.vehicleSrcService.getPrdDetail(prdbsc.getCarSourceId(),prjBscInfoVO.getPrjTypCd(),prjBscInfoVO.getBuOrgCd());
			BaseLogUtils.newWebLogger("获取车源库，车源信息").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
					.setWarning(false)
					.setKeys("prdDetail", JSON.toJSONString(prdDetail))
					.info();
			if(prdDetail!=null){
				if(null != prdDetail.getPrdNm()){
					prdBscInfoVO.setPrdNm(prdDetail.getPrdNm());
				}
				if(null != prdDetail.getPrdTypCd()){
					prdBscInfoVO.setPrdTypCd(prdDetail.getPrdTypCd());
				}
				if(null != prdDetail.getPrdCd()) {
					prdBscInfoVO.setPrdCd(prdDetail.getPrdCd());
				}
				if(null != prdDetail.getPrdMdl()) {
					prdBscInfoVO.setPrdMdl(prdDetail.getPrdMdl());
				}
				if(null != prdDetail.getCarStyleName()) {
					prdBscInfoVO.setCarStyleName(prdDetail.getCarStyleName());
				}
				if(null != prdbsc.getCertDt()){
					prdBscInfoVO.setCertDt(prdbsc.getCertDt());
				}
				if(StringUtils.isNotBlank(prdbsc.getVehCheckCode())){
					prdBscInfoVO.setVehCheckCode(prdbsc.getVehCheckCode());
				}
				if(null!=prdDetail.getCarSourceId()){
					prdBscInfoVO.setCarSourceId(prdDetail.getCarSourceId());
				}
				if(StringUtils.isNotBlank(prdDetail.getCarNo())){
					prdBscInfoVO.setCarNo(prdDetail.getCarNo());
				}
				if(StringUtils.isNotBlank(prdDetail.getBrCdNm())){
					prdBscInfoVO.setBrCd(prdDetail.getBrCdNm());
				}
				if(StringUtils.isNotBlank(prdDetail.getModelNm())){
					prdBscInfoVO.setModelNm(prdDetail.getModelNm());
				}
				/*if(StringUtils.isNotBlank(prdDetail.getVehCheckCode())){
					prdBscInfoVO.setVehCheckCode(prdDetail.getVehCheckCode());
				}*/
				if(null!=prdDetail.getReleaseDate()){
					prdBscInfoVO.setReleaseDate(prdDetail.getReleaseDate());
				}
				if(null!=prdDetail.getVin()){
					PrjPrdDtlVO prjprdDtlVO = new PrjPrdDtlVO();
					prjprdDtlVO.setVin(prdDetail.getVin());
					//校验vin
					boolean checkRes = vinUtilsApiService.validVinCheckBit(prdDetail.getVin());
					String checkResult = "0";
					if(checkRes){
						checkResult = "1";
					}
					prjprdDtlVO.setVinValidRes(checkResult);
					prdBscInfoVO.setDtl(prjprdDtlVO);
				}
			}
			//车源参配信息
			if(prdDetail!=null){
				extDTO.setId(prdBscInfoVO.getId());
				if(StringUtils.isNotBlank(prdDetail.getEngMdl())){
					extDTO.setEngMdl(prdDetail.getEngMdl());
				}
				if(null!=prdDetail.getHp()){
					extDTO.setHp(Long.valueOf(prdDetail.getHp()));
				}
				if(null!=prdDetail.getEmiStd()){
					extDTO.setEmiStd(prdDetail.getEmiStd());
				}
				if(null!=prdDetail.getmWhlSpec()){
					extDTO.setmWhlSpec(prdDetail.getmWhlSpec());
				}
				if(null!=prdDetail.getCntrSz()){
					extDTO.setCntrSz(prdDetail.getCntrSz());
				}
				if(null!=prdDetail.getMatQalCd()){
					extDTO.setMatQalCd(prdDetail.getMatQalCd());
				}
				if(null!=prdDetail.getTrlWhlSpec()){
					extDTO.setTrlWhlSpec(prdDetail.getTrlWhlSpec());
				}
				if(null!=prdDetail.getFuelTypCd()){
					extDTO.setFuelTypCd(prdDetail.getFuelTypCd());
				}
				if(null!=prdDetail.getCarLen()){
					extDTO.setCarLen(prdDetail.getCarLen());
				}
				if(null!=prdDetail.getOutVol()){
					extDTO.setOutVol(prdDetail.getOutVol());
				}
				if(null!=prdDetail.getSeatQtyCd()){
					extDTO.setSeatQtyCd(prdDetail.getSeatQtyCd());
				}
				if(null!=prdDetail.getDrvTypCd()){
					extDTO.setDrvTypCd(prdDetail.getDrvTypCd());
				}
				if(null!=prdDetail.getPowerTypCd()){
					extDTO.setPowerTypCd(prdDetail.getPowerTypCd());
				}
				if(null!=prdDetail.getMaxSpd()){
					extDTO.setMaxSpd(prdDetail.getMaxSpd());
				}
				if(null!=prdDetail.getEmiStdCd()){
					extDTO.setEmiStdCd(prdDetail.getEmiStdCd());
				}
				if(null!=prdDetail.getExtMil()){
					extDTO.setExtMil(Double.valueOf(prdDetail.getExtMil()));
				}
				if(null!=prdDetail.getCarVol()){
					extDTO.setCarVol(Long.valueOf(prdDetail.getCarVol()));
				}
				if(null!=prdDetail.getGerrBoxBrand()){
					extDTO.setGerrBoxBrand(prdDetail.getGerrBoxBrand());
				}
				if(null!=prdDetail.getStyleEngine()){
					extDTO.setStyleEngine(prdDetail.getStyleEngine());
				}
				if(null!=prdDetail.getCarMdl()){
					extDTO.setCarMdl(prdDetail.getCarMdl());
				}
				if(StringUtils.isNotBlank(prdDetail.getModelName())){
					extDTO.setModelName(prdDetail.getModelName());
				}
			}

			//车源检测信息
			if(prdDetail!=null){
				PrjPrdSourceInfoVO sourceInfoVO = new PrjPrdSourceInfoVO();
				sourceInfoVO.setId(prdBscInfoVO.getId());
				if(StringUtils.isNotBlank(prdDetail.getOwnerNm())){
					sourceInfoVO.setOwnerNm(prdDetail.getOwnerNm());
				}
				if(null!=prdDetail.getSurveyorId()){
					sourceInfoVO.setSurveyorId(prdDetail.getSurveyorId());
				}
				if(StringUtils.isNotBlank(prdDetail.getSurveyorNm())){
					sourceInfoVO.setSurveyorNm(prdDetail.getSurveyorNm());
				}
				if(null!=prdDetail.getDetectionDate()){
					sourceInfoVO.setDetectionDate(prdDetail.getDetectionDate());
				}
				if(null!=prdDetail.getVehVal()){
					BaseLogUtils.newWebLogger("获取车源网估值").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
							.setWarning(false)
							.setKeys("prdDetail", prdDetail.getVehVal().toString())
							.info();
					sourceInfoVO.setVehValNew(DecimalUtils.convertYuanToFen(Double.valueOf(prdDetail.getVehVal())).doubleValue());
					if (sourceInfoVO.getVehValNew() != 0){
						if(null!=sourceInfoVO.getDetectionDate()){
							Long day = DateUtils.getDaysBetweenTwoDates(sourceInfoVO.getDetectionDate(),new Date());
							sourceInfoVO.setTimeDiff(day.intValue());
						}
					}
				}
				if(null!=prdDetail.getParkingLot()){
					sourceInfoVO.setParkingLot(prdDetail.getParkingLot());
				}
				if(null!=prdDetail.getLicDt()){
					sourceInfoVO.setLicDt(prdDetail.getLicDt());
				}
				if(StringUtils.isNotBlank(prdDetail.getLicNo())){
					sourceInfoVO.setLicNo(prdDetail.getLicNo());
				}
				if(null!=prdDetail.getEstPurmaxpricea()){
					sourceInfoVO.setEstPurmaxprice(prdDetail.getEstPurmaxpricea()*100);
				}
				if(null!=prdDetail.getEstPurminpricea()){
					sourceInfoVO.setEstPurminprice(prdDetail.getEstPurminpricea()*100);
				}
				if(null!=prdDetail.getEstRetailmaxprice()){
					sourceInfoVO.setEstRetailmaxprice(prdDetail.getEstRetailmaxprice()*100);
				}
				if(null!=prdDetail.getEstRetailminprice()){
					sourceInfoVO.setEstRetailminprice(prdDetail.getEstRetailminprice()*100);
				}
				if(null!=prdDetail.getPurchasingPrice()){
					sourceInfoVO.setPurchasingPrice(prdDetail.getPurchasingPrice()*100);
				}
				if(null!=prdDetail.getEvaOfPrice()){
					sourceInfoVO.setEvaOfPrice(prdDetail.getEvaOfPrice()*100);
				}
				if(StringUtils.isNotBlank(prdDetail.getClassNm())){
					sourceInfoVO.setClassNm(prdDetail.getClassNm());
				}
				/*if(null!=prdBscInfoVO.getVehVal()){
					sourceInfoVO.setVehValNew(prdBscInfoVO.getVehVal());
				}*/
				if(null!=prdDetail.getPrvCode()){
					sourceInfoVO.setProvCd(prdDetail.getPrvCode());
				}
				if(null!=prdDetail.getCityCode()){
					sourceInfoVO.setCityCd(prdDetail.getCityCode());
				}
				if(StringUtils.isNotBlank(prdDetail.getPdfFilePath())){
					sourceInfoVO.setPdfFilePath(prdDetail.getPdfFilePath());
				}
				prdBscInfoVO.setPrjPrdSourceInfo(sourceInfoVO);
			}
			BaseLogUtils.newWebLogger("保存车源库数据入参").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
					.setWarning(false)
					.setKeys("prdBscInfoVO", JSON.toJSONString(prdBscInfoVO),"extDTO",JSON.toJSONString(extDTO))
					.info();
			this.prjPrdBscInfoService.modifyPrjPrdCarSourceDetailInfo(prdBscInfoVO,extDTO);
		}
	}

	@Override
	public PrjCheckResultDTO getFilterRiskResultByIsService(PrjCheckResultDTO prjCheckResultDTO, boolean filterFlag) throws BaseException {
		if(false == filterFlag){
			//如果不根据金融机构进行风控结果筛选，则直接返回
			return prjCheckResultDTO;
		}
		BaseLogUtils.newWebLogger("资方是否提供服务筛选prjCheckResultDTO").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
				.setWarning(false)
				.setKeys("prjCheckResultDTO", JSON.toJSONString(prjCheckResultDTO))
				.info();
		//获取资方提供服务的机构编码列表
		FriBaseInfoQueryCondition condition = new FriBaseInfoQueryCondition();
		condition.setIsService(BaseConstant.IS_YESNO_YES);
		List<FriBaseInfoVO> friBaseInfoVOList = FriBaseInfoVOTransform.toVOList(this.friBaseInfoApiService.searchList(condition));
		if(null == friBaseInfoVOList){
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "获取资方是否提供服务机构编码列表失败！");
		}
		//提供服务的金融机构编码集合
		List<String> serviceCodeList = new ArrayList<String>();
		if(friBaseInfoVOList.size()>0){
			for (FriBaseInfoVO seviceBaseInfoVo : friBaseInfoVOList){
				if(null != seviceBaseInfoVo.getInsCode()){
					serviceCodeList.add(seviceBaseInfoVo.getInsCode());
				}
			}
		}
		//风控资方编码映射列表
		List<SysDictionaryDTO> riskInsCodeList = this.sysDictionaryApiService.searchGroup(CapitalConstant.SYSCD, CapitalConstant.SYSORG, "RCT0025");
		if(null == riskInsCodeList){
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "获取风控资方编码映射列表失败!");
		}
		//提供服务的风控资方机构编码集合
		List<String> riskServiceCodeList = new ArrayList<String>();
		if(riskInsCodeList.size() > 0){
			for (SysDictionaryDTO riskDto: riskInsCodeList){
				//资方机构编码
				String sysInsCode = riskDto.getCodeAttr1();
				//风控机构编码映射
				String riskInsCode = riskDto.getCode();
				if(null == sysInsCode || "".equals(sysInsCode)){
					//没有机构编码映射关系则直接跳过
					continue;
				}
				//一对多映射的情况
				if(sysInsCode.indexOf(",") != -1){
					String[] sysInsCodeArray = sysInsCode.split(",");
					for(String sysInsCodeSimple : sysInsCodeArray){
						if(serviceCodeList.contains(sysInsCodeSimple)){
							riskServiceCodeList.add(riskInsCode);
							break;
						}
					}
				}else{
					if(serviceCodeList.contains(sysInsCode)){
						riskServiceCodeList.add(riskInsCode);
					}
				}
			}
		}
		BaseLogUtils.newWebLogger("提供服务的风控资方机构编码集合riskServiceCodeList").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
				.setWarning(false)
				.setKeys("riskServiceCodeList", JSON.toJSONString(riskServiceCodeList))
				.info();
		//前置征信客户rcCstBscInfoMap
		Map<String, Object> rcCstBscInfoMap = prjCheckResultDTO.getRcCstBscInfoMap();
		if(null != rcCstBscInfoMap){
			//解析客户征信返回结果，根据资方是否提供服务重新组装返回信息
			com.alibaba.fastjson.JSONArray rcCstBscInfoArray = com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(rcCstBscInfoMap.get("rcCstBscInfoList")));
			if(null != rcCstBscInfoArray && rcCstBscInfoArray.size()>0){
				BaseLogUtils.newWebLogger("前置征信客户rcCstBscInfoMap").setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
						.setWarning(false)
						.setKeys("rcCstBscInfoMap", JSON.toJSONString(rcCstBscInfoMap))
						.info();
				for(int i=0;i<rcCstBscInfoArray.size();i++){
					com.alibaba.fastjson.JSONObject rcCstBscInfoArrayObj = (com.alibaba.fastjson.JSONObject)rcCstBscInfoArray.get(i);
					//狮桥等级描述
					String rskLvlCdNm = rcCstBscInfoArrayObj.getString("rskLvlCdNm");
					//0,1-禁止操作,2-可以立项，3-禁止立项
					String audStsCd = rcCstBscInfoArrayObj.getString("audStsCd");
					//修改客户征信结果描述(狮桥)
					String audStsDescModify = rskLvlCdNm + "【狮桥】";
					if("0".equals(audStsCd) || "1".equals(audStsCd)){
						audStsDescModify += "禁止操作";
					}else if("2".equals(audStsCd)){
						audStsDescModify += "可以立项";
					}else if("3".equals(audStsCd)){
						audStsDescModify += "禁止立项";
					}else{
						audStsDescModify += "未知操作";
					}
					com.alibaba.fastjson.JSONArray rcCstResultDTOList = com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(rcCstBscInfoArrayObj.get("rcCstResultDTOList")));
					if(null != rcCstResultDTOList && rcCstResultDTOList.size()>0){
						Iterator<Object> iterator= rcCstResultDTOList.iterator();
						while(iterator.hasNext()){
							com.alibaba.fastjson.JSONObject rcCstResultDTOJson = (com.alibaba.fastjson.JSONObject)iterator.next();
							//机构编码
							String busTypSimple = rcCstResultDTOJson.getString("busTyp");
							//机构描述
							String busTypNmSimple = rcCstResultDTOJson.getString("busTypNm");
							//立项描述
							String audStsDescSimple = rcCstResultDTOJson.getString("audStsDesc");
							if(riskServiceCodeList.contains(busTypSimple)){
								audStsDescModify += "<BR/>【"+ busTypNmSimple +"】"+audStsDescSimple;
							}else{
								iterator.remove();
							}
						}
					}
					rcCstBscInfoArrayObj.put("audStsDesc",audStsDescModify);
					rcCstBscInfoArrayObj.put("rcCstResultDTOList",rcCstResultDTOList);
					/**
					 * 挂靠公司
					 */
					com.alibaba.fastjson.JSONArray rcCstChannelInfoDTOList = com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(rcCstBscInfoArrayObj.get("rcCstChannelInfoDTOList")));
					String lnkNm = "";
					if(null != rcCstChannelInfoDTOList && rcCstChannelInfoDTOList.size()>0){
						for (Object rcCstChannelInfoDTO : rcCstChannelInfoDTOList) {
							Integer channelTyp = (Integer)(((com.alibaba.fastjson.JSONObject) rcCstChannelInfoDTO).get("channelTyp"));
							String lnkType = (String)(((com.alibaba.fastjson.JSONObject) rcCstChannelInfoDTO).get("lnkType"));
							if(BaseConstant.IS_YESNO_YES_STR.equals(channelTyp)
									&& BaseConstant.IS_YESNO_NO_STR.equals(lnkType)){
								lnkNm = (String)(((com.alibaba.fastjson.JSONObject) rcCstChannelInfoDTO).get("channelNm"));
								break;
							}
						}
						com.alibaba.fastjson.JSONArray rcCstChannelInfoDTOListNew = new com.alibaba.fastjson.JSONArray();
						//REQ-12980 经销商征信等级取 和挂靠公司相比 最大等级
						Long rskLvlCd2 = Long.valueOf(rcCstBscInfoArrayObj.getString("rskLvlCd2"));
						String rskLvlCd3 = rcCstBscInfoArrayObj.getString("rskLvlCd3");
						for (int j=0;j<rcCstChannelInfoDTOList.size();j++) {
							com.alibaba.fastjson.JSONObject rcCstChannelInfoDTO = (com.alibaba.fastjson.JSONObject)rcCstChannelInfoDTOList.get(j);
							Integer channelTyp = (Integer)(((com.alibaba.fastjson.JSONObject) rcCstChannelInfoDTO).get("channelTyp"));
							String lnkType = (String)(((com.alibaba.fastjson.JSONObject) rcCstChannelInfoDTO).get("lnkType"));
							String finalUserLevel = (String)(((com.alibaba.fastjson.JSONObject) rcCstChannelInfoDTO).get("finalUserLevel"));
							//私户没有挂靠公司 直接跳出
							if(!(BaseConstant.IS_YESNO_YES == channelTyp)
									|| !BaseConstant.IS_YESNO_NO_STR.equals(lnkType)){
								continue;
							}
							//没有狮桥分跳出
							if(StringUtils.isBlank(finalUserLevel)){
								continue;
							}
							//Long splStarLevel =  rcCstChannelInfoDTO.getLong("splScore");
							SysDictionaryDTO sysDictionaryDTO = sysDictionaryApiService.getEntityByPriKey("11000","0000","RCT0001",finalUserLevel);
							if(sysDictionaryDTO != null){
								rcCstChannelInfoDTO.put("finalUserLevelNm",sysDictionaryDTO.getCodeNm());
							}
							//rcCstChannelInfoDTOList.set(j,rcCstChannelInfoDTO);
							rcCstChannelInfoDTOListNew.add(rcCstChannelInfoDTO);
							/*if(splStarLevel > rskLvlCd2){
								rskLvlCd2 = splStarLevel;
							}*/
						}
						//重新设置挂靠公司
						rcCstBscInfoArrayObj.put("rcCstChannelInfoDTOList",rcCstChannelInfoDTOListNew);
						SysDictionaryDTO sysDictionaryDTO = sysDictionaryApiService.getEntityByPriKey("11000","0000","RCT0001",rskLvlCd2.toString());
						if(sysDictionaryDTO != null){
							rskLvlCdNm = sysDictionaryDTO.getCodeNm();
							rcCstBscInfoArrayObj.put("rskLvlCdNm",rskLvlCdNm);
						}
					}
					rcCstBscInfoArrayObj.put("lnkNm",lnkNm);
					rcCstBscInfoArray.set(i,rcCstBscInfoArrayObj);
				}
				rcCstBscInfoMap.put("rcCstBscInfoList",rcCstBscInfoArray);
				BaseLogUtils.newWebLogger("前置征信客户rcCstBscInfoMap").setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
						.setWarning(false)
						.setKeys("rcCstBscInfoMap", JSON.toJSONString(rcCstBscInfoMap))
						.info();
				prjCheckResultDTO.setRcCstBscInfoMap(rcCstBscInfoMap);
			}
		}
		//前置征信客户-子机构征信信息rcCstResultMap
		Map<String, Object> rcCstResultMap = prjCheckResultDTO.getRcCstBscInfoMap();
		if(null != rcCstResultMap){
			com.alibaba.fastjson.JSONObject rcCstResultMapObj = (com.alibaba.fastjson.JSONObject)rcCstResultMap.get("rcCstResultMap");
			if(null != rcCstResultMapObj){
				//对浙商银行单独做处理
				if(!riskServiceCodeList.contains("CZBANK")){
					rcCstResultMapObj.remove("浙商银行");
				}
				rcCstResultMap.put("rcCstResultMap",rcCstResultMapObj);
				BaseLogUtils.newWebLogger("前置征信客户rcCstBscInfoMap").setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
						.setWarning(false)
						.setKeys("rcCstBscInfoMap", JSON.toJSONString(rcCstBscInfoMap))
						.info();
				prjCheckResultDTO.setRcCstResultMap(rcCstResultMap);
			}
		}
		BaseLogUtils.newWebLogger("资方是否提供服务筛选prjCheckResultDTO").setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_QUAT_MANAGER_CD)
				.setWarning(false)
				.setKeys("prjCheckResultDTO", JSON.toJSONString(prjCheckResultDTO))
				.info();
		return prjCheckResultDTO;
	}

	@Override
	public Pager searchExpBusinessListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = this.projectApiService.searchExpBusinessListPage(page, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		//风险隐患
		Map<String, String> hidRiskCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_HID_RISK_CD);
		page.setResultList(PrjBscInfoVOTransform.toVOList((List<PrjBscInfoDTO>) page.getResultList()));
		List<PrjBscInfoVO> voList = (List<PrjBscInfoVO>)page.getResultList();
		if(CollectionUtils.isNotEmpty(voList)){
			for (PrjBscInfoVO vo : voList){
				if(hidRiskCdMap.containsKey(vo.getHidRisk())){
					vo.setHidRisk(hidRiskCdMap.get(vo.getHidRisk()));//风险隐患
				}
			}
		}
		return page;
	}

	@Override
	public List<KeyValueVO> getHidRiskList() throws BaseException {
		String code = DictionaryConstant.CODE_HID_RISK_CD;
		return this.getKeyValueList(code);
	}

	@Override
	public boolean modifyRealSpl(PrjBscInfoVO entity) throws BaseException {
		if (null == entity)
			return false;
		return this.projectApiService.modifyPrjBscInfo(PrjBscInfoVOTransform.toDTO(entity));
	}

	@Override
	public List<PrjBscInfoVO> searchPrePrjBscInfoList(PrjBscInfoQueryCondition condition) throws BaseException {
        List<PrjBscInfoVO> voList = PrjBscInfoVOTransform.toVOList(projectApiService.searchPrePrjBscInfoList(condition));
        return voList;
	}

	@Override
	public String getPrjIdByPrjId(String prjId) throws BaseException {
		PrjBscInfoVO prjBscInfoVO = this.selectById(Long.parseLong(prjId));
		String yqPrjId="";
		if (prjBscInfoVO != null && "CDDYWYQ".equals(prjBscInfoVO.getPrjTypCd())) {//如果是这个项目类型的话，去查询对应老项目的担保人信息
			PrjPaySchMYqQC prjPaySchMYqQC = new PrjPaySchMYqQC();
			prjPaySchMYqQC.setPrjId(Long.parseLong(prjId));
			prjPaySchMYqQC.setIsDel(0);
			List<PrjPaySchMYqDTO> prjPaySchMYqDTOS = prjPaySchMYqApiService.searchList(prjPaySchMYqQC);
			BaseLogUtils.newLogger("疫情项目查询担保人结果为prjId=" + prjId + ",prjPaySchMYqDTOS=" + JSON.toJSONString(prjPaySchMYqDTOS)).info();
			if (CollectionUtils.isNotEmpty(prjPaySchMYqDTOS) && null != prjPaySchMYqDTOS.get(0) && StringUtils.isNotEmpty(prjPaySchMYqDTOS.get(0).getyPrjId())) {
				yqPrjId = prjPaySchMYqDTOS.get(0).getyPrjId().toString();
			}
		}
		BaseLogUtils.newLogger("疫情项目查询项目id结果为yqPrjId=" + yqPrjId).info();
		return "".equals(yqPrjId) ? prjId : yqPrjId;
	}

	@Override
	public boolean isYcOrgCheck(String orgCd) throws BaseException {
		return this.projectApiService.isYcOrgCheck(orgCd);
	}
}